Floating Server V2
Certificate and signature verification
#include <LicenseSpring/ExtendedOptions.h>
options.setCertificateChainFromFile("chain.pem");
// or
options.setCertificateChain(R"(...cert...)");options.setCertificateChainFromFile("chain.pem");
// or
options.CertificateChain = "(...cert...)";# API client configuration
from licensespring.floating_server import FloatingAPIClient
api_client = FloatingAPIClient(api_protocol="http",api_domail="localhost:8080",certificate_chain_path="path_to_pem_file/chain.pem")
# Floating Manager configuration
from licensespring.licensefile.config import Configuration
from licensespring.licensefile.floating_manager import FloatingManager
conf = Configuration(product="your_product_key",api_key="your_api_key",
shared_key="your_shared_key",file_key=key,file_iv=iv,
is_guard_file_enabled=True,certificate_chain_path="path_to_pem_file/chain.pem")
fs_manager = FloatingManager(conf=conf)Authentication and license registration
#include <LicenseSpring/FloatingClient.h>
#include <LicenseSpring/ExtendedOptions.h>
// ...
LicenseSpring::ExtendedOptions options;
options.setCertificateChainFromFile("chain.pem");
// or
options.setCertificateChain(R"(...cert...)");
// and other options ...
auto config = LicenseSpring::Configuration::Create(/*...*/);
auto fc = LicenseSpring::FloatingClient::create(config);
// Authenticate the user if it is required
// You should first create the user on the Floating server itself
fc->authenticateUser("user", "pass");
// FloatingClient::getAllLicenses returns one LicenseID for each license tied to the configured product code
std::vector<LicenseSpring::LicenseID> licenseIds = fc->getAllLicenses();
// check if at least one license exists
if (licenseIds.empty())
return 1;
for (const auto &licenseId : licenseIds)
{
std::cout << "Server-side license ID: " << licenseId.serverId();
// licenseId.key() will return the license key of the license
}
// register the first license, same as on Floating Server v1
auto licenseId = licenseId.front();
std::string username = "John";
auto license = fc->registerLicense(username, licenseId); Was this helpful?