Application scenario and acceptance checks
For an isolated C++ workstation, generate the activation request on that device, transfer it to an online computer, obtain the signed response, then import it on the original device. Reject a mismatched device or expired grant. An offline client cannot immediately learn of server-side revocation; enforcement follows its signed validity and refresh rules.
1. Choose an offline policy
For C++ software on an air-gapped computer, export a device-bound activation request, approve it from an Internet-connected computer, then import the signed response on the original machine. This file-exchange workflow requires a node-locked license whose policy permits offline activation. Floating licenses still require an online session. A temporary outage after online activation uses an already signed local grant until its offline deadline. An air-gapped computer instead uses the request/response files below; indefinite offline use requires a policy that permits permanent offline grants, and a timed or trial license still expires at its own deadline.
A fixed device returns workspace capacity when its online window expires after the last successful contact. Its binding remains. A floating device returns capacity when its last session is released or its lease expires.
- Copy the Product ID from Console > Products. Open that product’s Signing public keys and paste every key ID/public key pair into the initialization code, replacing YOUR_PRODUCT_ID, YOUR_KEY_ID and YOUR_PUBLIC_KEY. Quick integration can generate these public code constants. No product configuration file is required; the SDK defaults to https://www.licentivo.com.
2. Install the native SDK
Install CMake 3.21 or later. On Windows x64, use Visual Studio 2022 C++ Build Tools and the matching MSVC SDK package, with -G "Visual Studio 17 2022" -A x64. On Linux x64, use C11/C++17 compilers. Replace SDK_PREFIX with the CMake prefix printed by the installer. Save the example as offline.cpp and the CMakeLists.txt below in the same directory. Complete installation and compilation on a connected computer, then copy the executable and its runtime dependencies to the offline computer.
Install a shared libcurl development package matching the compiler and architecture. For Windows MSVC x64, replace CURL_DIR with the directory containing CURLConfig.cmake, add curl's bin directory to PATH for local runs, and distribute the required DLLs with your application; on Linux, install your distribution's shared libcurl development package.
& ([scriptblock]::Create((Invoke-WebRequest 'https://www.licentivo.com/assets/sdk/releases/v0.11.9/install.ps1').Content)) -Language cpp -Toolchain msvccurl --fail --silent --show-error --location --proto '=https' --proto-redir '=https' 'https://www.licentivo.com/assets/sdk/releases/v0.11.9/install.sh' | bash -s -- cppcmake_minimum_required(VERSION 3.18)
project(offline_activation LANGUAGES C CXX)
find_package(Licentivo 0.11.9 REQUIRED)
add_executable(offline offline.cpp)
target_link_libraries(offline PRIVATE Licentivo::CPP)
set_target_properties(offline PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="SDK_PREFIX" -DCURL_DIR="CURL_DIR"
if ($LASTEXITCODE -ne 0) { throw 'CMake configure failed. Check the SDK prefix and matching libcurl development package.' }
cmake --build build --config Release --target offline
if ($LASTEXITCODE -ne 0) { throw 'Build failed.' }set -e
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="SDK_PREFIX"
cmake --build build --target offline3. Export and import using the SDK
Save the example as offline.cpp and add it to your SDK-enabled CMake project. Run offline request YOUR_LICENSE_KEY on the offline computer. It produces activation.request.json without opening an online client.
Move that request to a connected computer. In the vendor console or the associated customer's portal, upload the request and download its approved response. Save it as activation.response.json, then return both files to the original computer and run offline import YOUR_LICENSE_KEY.
#include "licentivo.hpp"
#include <fstream>
#include <iostream>
#include <iterator>
#include <stdexcept>
#include <string>
// BEGIN LICENTIVO PRODUCT
// Copy Product ID and all key ID/public key pairs from Console > Products > Signing public keys.
static const std::string PRODUCT_ID = "YOUR_PRODUCT_ID";
static const std::string TRUSTED_KEYS_JSON = R"({"YOUR_KEY_ID":"YOUR_PUBLIC_KEY"})";
// END LICENTIVO PRODUCT
std::string readText(const char* path) {
std::ifstream file(path);
if (!file) throw std::runtime_error("Cannot read file");
return {std::istreambuf_iterator<char>(file), {}};
}
int main(int argc, char** argv) {
try {
// Product settings are in code; the key is entered by the customer.
if (argc < 3) throw std::runtime_error("Usage: offline request|import LICENSE_KEY");
auto client = licentivo::Client::ForProduct(PRODUCT_ID, TRUSTED_KEYS_JSON, argv[2]);
if (std::string(argv[1]) == "request") {
std::ofstream file("activation.request.json");
file << client.OfflineRequest();
if (!file) throw std::runtime_error("Cannot save request");
std::cout << "Created activation.request.json\n";
} else if (std::string(argv[1]) == "import") {
client.ImportOffline(readText("activation.request.json"),
readText("activation.response.json"));
client.RunFeature("export", [] {
std::ofstream file("licensed-report.txt");
file << "Licensed offline export\n";
if (!file) throw std::runtime_error("Cannot save report");
});
std::cout << "Created licensed-report.txt\n";
} else {
throw std::runtime_error("Unknown operation");
}
} catch (const std::exception& error) {
std::cerr << error.what() << '\n';
return 1;
}
}./build/Release/offline.exe request YOUR_LICENSE_KEY./build/Release/offline.exe import YOUR_LICENSE_KEY./build/offline request YOUR_LICENSE_KEY./build/offline import YOUR_LICENSE_KEY4. Check the result
- Confirm the import succeeds and licensed-report.txt is created.
- Restart using the stored device credential and the same cache location. A still-valid offline lease should allow the entitled feature.
- Try importing on another ordinary computer: device validation should reject that response.
- Check the authorization expiry and offline duration. File import does not extend the original license or permit use beyond its signed limits.
Using the C interface
For C, create an unstarted client with ln_init_product using the product ID, trusted public keys and customer license key. Generate the request with ln_offline_request, then verify and import the request and response with ln_import_offline. Free returned strings with ln_free_string and release the client with ln_destroy.
For the first fully offline activation, do not call ln_start or ln_open: they attempt online startup. Use the request/import flow above and let the SDK verify the signed response; do not parse signatures in your business code.
Common failures and operational limits
Check the product ID, every key ID/public key pair and the customer’s license input. Public verification keys belong to a product; customer licenses and saved device credentials are separate. Do not distribute development test keys or vendor management API keys.
An invalid response can mean the original request, product, device, signing key or application version does not match. Bring the signed response back to the computer that generated its request. Do not edit JSON payloads or disable verification.
An expired request needs a new request and approval. An expired lease needs renewal or another approved file exchange according to the policy. Online metered reserve/commit operations are unavailable while fully offline.
A remote unbind or revocation becomes known on the old device's next online check. A permanently offline device cannot immediately learn a server-side change. Choose the offline duration with that limitation in mind.
Configuration and next steps
Example tested
Environment: Windows x64, Visual Studio 2022 17.14.32, MSVC 19.44, Windows SDK 10.0.26100.0, native SDK 0.11.8, shared libcurl 8.22.0, MySQL 8.4.13
Tests use an isolated local API and MySQL with SDK 0.11.8. Only the API origin and private cache location are redirected for testing. Public registry downloads, Electron, Linux and macOS were not tested in this run.
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH="SDK_PREFIX" -DCURL_DIR="CURL_DIR"
cmake --build build --config Release --target offline
./build/Release/offline.exe request YOUR_LICENSE_KEY
./build/Release/offline.exe import YOUR_LICENSE_KEYVisual Studio 2022 Release build: PASS
Offline request and approved import: PASS, protected report created
Import with a tampered signature: rejected, no file written
Original approved response after the rejected import: PASS
Expired signed grant after a real wait under a 5-second test policy: rejected, no file written