README.md | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
example/example.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tools/bootstrap/bootstrap.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tools/license-generator/license-generator.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
README.md
@@ -1,7 +1,7 @@ # Open License Manager  A lincense manager written in C/C++ for Windows and Linux environments. A license manager written in C/C++ for Windows and Linux environments. It allows to protect the software you develop from unauthorized copies, limit the usage in time, to a specific set of machines, or prevent the usage in @@ -15,7 +15,7 @@ these modules are planned.... * a license [backoffice](../../issues/7) in php (in order to handle multiple licenses). * a license debugger to be sent to the final customer when there are licensing problems. * a [log decriptor](../../issues/8) in order to decrypt logs generated by the license system. * a [log descriptor](../../issues/8) in order to decrypt logs generated by the license system. You can notice 2 more sub-projects: * bootstrap: allows to generate private keys and modify the library on the fly after the downloading. example/example.cpp
@@ -2,6 +2,7 @@ #include <map> #include "api/license++.h" #include "pc-identifiers.h" #include "../../src/library/ini/SimpleIni.h" using namespace std; @@ -15,11 +16,11 @@ stringByEventType[FILE_FORMAT_NOT_RECOGNIZED ] = "license file has invalid format (not .ini file) "; stringByEventType[LICENSE_MALFORMED ] = "some mandatory field are missing, or data can't be fully read. "; stringByEventType[PRODUCT_NOT_LICENSED ] = "this product was not licensed "; stringByEventType[PRODUCT_EXPIRED ] = "licence expired "; stringByEventType[PRODUCT_EXPIRED ] = "license expired "; stringByEventType[LICENSE_CORRUPTED ] = "license signature didn't match with current license "; stringByEventType[IDENTIFIERS_MISMATCH ] = "Calculated identifier and the one provided in license didn't match"; stringByEventType[LICENSE_FILE_FOUND ] = "licence file not found "; stringByEventType[LICENSE_VERIFIED ] = "licence verified "; stringByEventType[LICENSE_FILE_FOUND ] = "license file not found "; stringByEventType[LICENSE_VERIFIED ] = "license verified "; const string licLocation("example.lic"); @@ -29,16 +30,27 @@ licenseLocation.licenseFileLocation = licLocation.c_str(); licenseLocation.environmentVariableName = ""; EVENT_TYPE result = acquire_license("example", licenseLocation, &licenseInfo); if (result != LICENSE_OK){ PcSignature signature; FUNCTION_RETURN generate_ok = generate_user_pc_signature(signature, ETHERNET); PcSignature signature; FUNCTION_RETURN generate_ok = generate_user_pc_signature(signature, ETHERNET); if (result == LICENSE_OK && licenseInfo.linked_to_pc) { CSimpleIniA ini; SI_Error rc = ini.LoadFile(licLocation.c_str()); string IDinLicense = ini.GetValue("example", "client_signature", ""); if (IDinLicense == "") { cout << "No client signature in license file, generate license with -s <id>"; result = IDENTIFIERS_MISMATCH; } else if (IDinLicense != signature) { result = IDENTIFIERS_MISMATCH; } } if (result != LICENSE_OK) { cout << "license ERROR :" << endl; cout << " " << stringByEventType[result].c_str() << endl; cout << "the pc signature is :" << endl; cout << " " << signature << endl; } else cout << "licence OK" << endl; cout << "license OK" << endl; } src/tools/bootstrap/bootstrap.cpp
@@ -3,6 +3,7 @@ #include <string> #include <stdlib.h> #include <iostream> #include <sys/stat.h> using namespace std; namespace license { @@ -73,6 +74,12 @@ } } bool file_exists (const std::string & name) { struct stat buffer; return (stat (name.c_str(), &buffer) == 0); } int main(int argc, char** argv) { if (argc != 3) { @@ -87,6 +94,11 @@ string private_fname = string(argv[1]); string public_fname(argv[2]); if (file_exists(private_fname) || file_exists(public_fname)) { printf("Key files exist, skipping key generation. Do 'make clean' to generate new keys.\n"); exit(0); } license::generatePk(private_fname, public_fname); return 0; } src/tools/license-generator/license-generator.cpp
@@ -153,7 +153,7 @@ int LicenseGenerator::generateLicense(int argc, const char **argv) { po::options_description visibleOptions = configureProgramOptions(); //positional options must be addedd to standard options //positional options must be added to standard options po::options_description allOptions; allOptions.add(visibleOptions).add_options()("product", po::value<vector<string>>(), "product names");