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(
"https://api.permitcore.dev"
);
auto activated = client.activate_offline(
token, public_key_base64, device_id
);
if (!activated.is_valid)
throw std::runtime_error(activated.message);
auto result = client.validate_offline(device_id);From product record to paid customer
Use PermitCore for the licensing layer and the sale. Your customer checks out in your branded Store and receives a working license automatically.
- 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.
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 Stripe account, add the product to your branded PermitCore Store, and publish. Checkout creates the license and delivers it to the customer without a webhook project or a second commerce platform.
- Publish the correct architecture and version
- Add the build to your Store
- Connect your own Stripe account
- Document offline activation for buyers
One checkout completes the sale and delivers the license.
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.