How to add offline license validation to a C++ app
Install the SDK from PermitCore's vcpkg registry, verify a signed activation token without a server call, and sell the native build through a checkout connected to licensing.
vcpkg install permitcore-sdk
#include <permitcore/permit_client.hpp>
permitcore::PermitClient client(api_url, 10, true,
{trusted_public_key}, app_cache_directory, device_id);
auto activated = client.activate_offline(
token, device_id, product_id
);
if (!activated.is_valid)
throw std::runtime_error(activated.message);
auto result = client.validate_offline(device_id, product_id);
if (!result.is_valid)
throw std::runtime_error(result.message);From product record to paid customer
Use PermitCore for the licensing layer and Store checkout. Verified paid evidence triggers the configured license issuance and queues the delivery email; test actual delivery before launch.
- 01Create
Create the product and license policy
In Products, create the software your key unlocks. Choose its activation limit, validity, offline grace period, version range, and feature flags.
- Create the native application product
- Choose device and expiry limits
- Issue a test offline token
- Download the tenant public key
- 02Implement
Install the C++ SDK and scope the key
Put license activation in the first-run flow and validation at startup. Pass your product ID so a valid key for another product cannot unlock this one.
These are application fragments: supply your own key/product variables and UI or host flow. A validation call does not register a device or reserve a floating session. Check failure before protected work. Offline use needs explicitly configured trusted public keys; follow the SDK 2.1.1 offline setup. For C++, use the vcpkg registry and pinned baseline in its installation reference, rather than assuming a built-in public port.
vcpkg install permitcore-sdk- Configure PermitCore's vcpkg registry
- Link permitcore::permitcore
- Bind the token on first run
- Re-verify the persisted token at startup
- 03Verify
Test the real validation path
Issue a test offline token, verify and bind it on the target device, then test a tampered token, an expired token, and a different device ID. Local verification uses ECDSA P-256 and does not call the API.
- 04Sell
Publish the product in your Store
Connect your chosen Stripe, Paddle or Lemon Squeezy account, add the product to your branded PermitCore Store, and publish. Account credentials, matching catalog prices and signed webhook configuration are required. PermitCore processes the verified payment and handles Store license fulfillment.
- Publish the correct architecture and version
- Add the build to your Store
- Connect your chosen Store payment provider
- Document offline activation for buyers
Verified payment triggers license issuance and the delivery email queue.
C++ production checklist
The sample is intentionally small. Add these safeguards before making licensing part of a paid release.
- Pin the custom-registry baseline from the SDK documentation for repeatable builds.
- Ship the public key only; never embed a private signing or Admin credential.
- Keep validation failure paths deterministic and independent of exception text.
- Plan license transfer for hardware replacements before enforcing device binding.