open-license-manager
2014-09-16 1e166c13aaabe8d2aad1d604c77020a14dc577cd
src/tools/license-generator/license-generator.cpp
@@ -1,7 +1,7 @@
#include <build_properties.h>
#include "LicenseSigner.h"
#include <private-key.h>
#include "license-generator.h"
#include "../library/base/StringUtils.h"
#include "../base_lib/CryptoHelper.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
@@ -115,10 +115,8 @@
   if (vm.count("extra_data")) {
      extra_data = vm["extra_data"].as<string>();
   }
   unsigned int from_sw_version = vm["start_version"].as<
         unsigned int>();
   unsigned int to_sw_version =
         vm["end_version"].as<unsigned int>();
   unsigned int from_sw_version = vm["start_version"].as<unsigned int>();
   unsigned int to_sw_version = vm["end_version"].as<unsigned int>();
   if (vm.count("product") == 0) {
      cerr << endl << "Parameter [product] not found. " << endl;
      exit(2);
@@ -140,12 +138,13 @@
void LicenseGenerator::generateAndOutputLicenses(const po::variables_map& vm,
      ostream& outputFile) {
   vector<FullLicenseInfo> licenseInfo = parseLicenseInfo(vm);
   license::LicenseSigner licSigner =
         vm.count("private_key") == 0 ?
               license::LicenseSigner() :
               license::LicenseSigner(vm["private_key"].as<string>());
   unique_ptr<CryptoHelper> helper = CryptoHelper::getInstance();
   const char pkey[] = PRIVATE_KEY;
   size_t len = sizeof(pkey);
   for (auto it = licenseInfo.begin(); it != licenseInfo.end(); ++it) {
      licSigner.signLicense(*it);
      const string license = it->printForSign();
      string signature = helper->signString((const void *)pkey,len,license);
      it->license_signature = signature;
      it->printAsIni(outputFile);
   }
}
@@ -187,7 +186,6 @@
   }
   return 0;
}
const std::string formats[] = { "%4u-%2u-%2u","%4u/%2u/%2u","%4u%2u%2u" };
const size_t formats_n = 3;