Comprehensive guides, API reference, and examples for professional software licensing with HMAC-SHA256 security, hardware fingerprinting, and WebAssembly support.
# 1. Purchase LicenseCore++ from licensecore.tech
# 2. Download your licensed package
# 3. Extract and build
unzip LicenseCore-Professional.zip
cd LicenseCore
chmod +x build.sh
./build.sh
# 4. Test examples
cd build
./examples/simple_example
./examples/hwid_tool
./examples/license_generator --help
#include <license_core/license_manager.hpp>
using namespace license_core;
int main() {
try {
// Initialize with secret key
LicenseManager manager("your-secret-key-here");
// Validate license
auto info = manager.load_and_validate(license_json);
if (info.valid && manager.has_feature("premium")) {
std::cout << "Welcome, " << info.user_id << "!" << std::endl;
// Enable premium features
}
} catch (const LicenseException& e) {
std::cerr << "License error: " << e.what() << std::endl;
}
return 0;
}
find_package(LicenseCore REQUIRED)
target_link_libraries(your_app LicenseCore::licensecore)
# Platform-specific dependencies
if(WIN32)
target_link_libraries(your_app iphlpapi ole32 oleaut32)
elseif(APPLE)
target_link_libraries(your_app "-framework IOKit" "-framework CoreFoundation")
elseif(UNIX)
target_link_libraries(your_app pthread)
endif()
Core license validation and management with HMAC-SHA256 signatures and hardware binding.
class LicenseManager {
public:
explicit LicenseManager(const std::string& secret_key);
// Core functionality
LicenseInfo load_and_validate(const std::string& license_json);
bool has_feature(const std::string& feature) const;
void require_feature(const std::string& feature) const;
// Utility methods
std::string generate_license(const LicenseInfo& info) const;
std::string get_current_hwid() const;
bool is_expired() const;
// Configuration
void set_hardware_config(const HardwareConfig& config);
void set_strict_validation(bool strict = true);
};
Hardware identification with caching, cross-platform support, and configurable components.
class HardwareFingerprint {
public:
explicit HardwareFingerprint(const HardwareConfig& config = {});
// Fingerprint generation
std::string get_fingerprint() const; // May throw
std::string get_fingerprint_safe() const; // No exceptions
// Individual components
std::string get_cpu_id() const;
std::string get_mac_address() const;
std::string get_volume_serial() const;
// Cache management
void clear_cache() const;
CacheStats get_cache_stats() const;
};
Cryptographic signature operations with OpenSSL backend and secure key handling.
class HMACValidator {
public:
explicit HMACValidator(const std::string& secret_key);
// Signature operations
std::string sign(const std::string& data) const;
bool verify(const std::string& data, const std::string& signature) const;
void verify_or_throw(const std::string& data, const std::string& signature) const;
// JSON utilities
std::string sign_json(const std::string& json_without_signature) const;
bool verify_json(const std::string& json_with_signature) const;
};
#include <license_core/license_manager.hpp>
#include <iostream>
int main() {
try {
LicenseManager manager("my-secret-key");
// Load license from file or string
std::string license_json = load_license_file("license.json");
// Validate license
auto result = manager.load_and_validate(license_json);
if (result.valid) {
std::cout << "✅ License valid for: " << result.user_id << std::endl;
// Check specific features
if (manager.has_feature("premium")) {
std::cout << "🌟 Premium features enabled" << std::endl;
}
if (manager.has_feature("api_access")) {
std::cout << "🔌 API access granted" << std::endl;
}
} else {
std::cout << "❌ License validation failed: " << result.error_message << std::endl;
}
} catch (const InvalidSignatureException& e) {
std::cout << "🚨 Invalid license signature" << std::endl;
} catch (const ExpiredLicenseException& e) {
std::cout << "⏰ License has expired" << std::endl;
} catch (const HardwareMismatchException& e) {
std::cout << "🖥️ Hardware mismatch" << std::endl;
} catch (const LicenseException& e) {
std::cout << "❌ License error: " << e.what() << std::endl;
}
return 0;
}
#include <license_core/hardware_fingerprint.hpp>
int main() {
// Configure hardware components
HardwareConfig config;
config.use_cpu_id = true; // Enable CPU ID
config.use_mac_address = true; // Enable MAC address
config.use_volume_serial = true; // Enable volume serial
config.use_motherboard_serial = false; // Disable motherboard (unstable)
// Caching configuration
config.enable_caching = true;
config.cache_lifetime = std::chrono::minutes(10);
config.thread_safe_cache = true;
HardwareFingerprint fingerprint(config);
try {
std::string hwid = fingerprint.get_fingerprint();
std::cout << "Hardware ID: " << hwid << std::endl;
// Get individual components
std::string cpu_id = fingerprint.get_cpu_id();
std::string mac_addr = fingerprint.get_mac_address();
std::cout << "CPU ID: " << cpu_id << std::endl;
std::cout << "MAC Address: " << mac_addr << std::endl;
} catch (const HardwareDetectionException& e) {
std::cout << "Hardware detection failed: " << e.what() << std::endl;
// Use safe version as fallback
std::string safe_hwid = fingerprint.get_fingerprint_safe();
std::cout << "Fallback Hardware ID: " << safe_hwid << std::endl;
}
return 0;
}
#include <license_core/license_manager.hpp>
#include <chrono>
std::string generate_customer_license(const std::string& customer_id,
const std::string& customer_hwid,
const std::vector<std::string>& features,
int validity_days) {
LicenseManager manager("server-secret-key");
// Create license info
LicenseInfo license;
license.user_id = customer_id;
license.license_id = "lic-" + std::to_string(std::time(nullptr));
license.hardware_hash = customer_hwid;
license.features = features;
// Set timestamps
auto now = std::chrono::system_clock::now();
license.issued_at = now;
license.expiry = now + std::chrono::hours(24 * validity_days);
license.version = 1;
// Generate signed license
return manager.generate_license(license);
}
int main() {
// Example: Generate enterprise license
std::vector<std::string> enterprise_features = {
"basic", "premium", "enterprise", "api_access", "priority_support"
};
std::string license = generate_customer_license(
"enterprise-customer-001",
"a1b2c3d4e5f6...", // Customer's hardware ID
enterprise_features,
365 // 1 year validity
);
std::cout << "Generated license:" << std::endl;
std::cout << license << std::endl;
return 0;
}
// JavaScript/TypeScript integration
import LicenseCoreModule from './license_core.js';
async function initializeLicensing() {
// Load WASM module
const wasmModule = await LicenseCoreModule();
const manager = new wasmModule.LicenseCoreWasm('secret-key');
// Get hardware ID (browser simulation)
const hwid = manager.getCurrentHwid();
console.log('Browser Hardware ID:', hwid);
// Generate license with WASM
const features = new wasmModule.VectorString();
features.push_back('premium');
features.push_back('api');
const license = manager.generateLicense('user-123', features, 365);
console.log('Generated license:', license);
// Validate license
const result = manager.validateLicense(license);
console.log('Valid:', result.valid);
console.log('User:', result.user_id);
console.log('Features:', result.features);
// Clean up
features.delete();
}
// Initialize when page loads
initializeLicensing().catch(console.error);
LicenseCore++ is commercial software. All usage requires a valid license.
This is proprietary commercial software. All components require a valid license for any use, including evaluation, development, and production deployment.
📞 Questions? Contact sales@licensecore.tech