Skip to content
Oclavex is in private preview, open to existing MonetizeIt users. New users who would like to evaluate Oclavex before the public launch can request access at info@revenusion.com.

Offline (air-gapped) activation

A machine with intermittent connectivity doesn’t need file-based activation — the .NET SDK caches the license on disk and validates it offline until its lease runs out, or longer when it borrows its seat. This page is for machines that never connect: activation and lease renewal travel as files.

Everything rests on one trust anchor: license artifacts are signed with the provider’s key, and the device verifies them with the public key you shipped — no network required. The public key is safe to ship: it can verify, not mint, so carrying it on the device grants an attacker nothing. What is worth protecting is the cached license itself once it lands on disk — see at-rest encryption, which the offline flow gets automatically since it uses the same LicenseFileStore.

  1. On the device — the SDK writes an activation request file (activation code, fingerprint, application info).
  2. Carry it out — USB stick, one-way transfer, whatever your site allows.
  3. In a portal — the customer uploads the request under Offline activation in the User Portal, or an operator does it in the Provision Portal. The server runs the normal activation pipeline and returns a signed response file.
  4. Carry it back — return the response file to the device.
  5. On the device — the SDK imports the response, verifies the signature and installs the license.
carried by hand — USB, one-way transfer Air-gapped device never networked writes request files, imports signed files, queues usage locally verifies everything with the provider public key Provision Portal Offline activation page issues signed responses, ingests usage & extends the lease idempotent: re-upload never consumes a seat 1 · activation-request.json 2 · signed response — the license 3 · usage-export.zip 4 · signed receipt — fresh lease

Add-on package: Revenusion.Oclavex.Client.OfflineStore (alongside Client.LicenseConsumer).

Set up the device’s identity, store and key

Section titled “Set up the device’s identity, store and key”

The samples below use four objects, made once on the device:

using System;
using Revenusion.Oclavex.Client.LicenseConsumer.Services.Store;
// The device's fingerprint, from its network adapters and its name: the same one the online flow uses.
INodeIdProvider nodeIdProvider = DeviceNodeId.Create();
// Where the installed license is kept.
ILicenseStore licenseStore = new LicenseStoreBuilder()
.UseNodeId(nodeIdProvider)
.UseLicenseFolderLocation(LicenseFileStore.LicenseFolderLocation.UserDefined, @"C:\ProgramData\MyApp\License")
.Build();
// The provider's public signing key, which verifies every file the server signs.
ILicensePublicKeyProvider publicKeyProvider = InMemoryPublicKeyProvider.Create("<base64 public key>");
// Your application's name and version: the same in the request, the import and the client.
IApplicationInfoProvider applicationInfoProvider = RuntimeApplicationInfo.Create(
applicationName: "Acme Studio", applicationVersion: new Version(3, 1));

Pin every live key with its id instead when the provider rotates keys: InMemoryPublicKeyProvider.Create(keysByKeyId).

using Revenusion.Oclavex.Client.LicenseConsumer.Features.OfflineActivation;
var request = new OfflineActivationRequestBuilder()
.WithActivationCode("ABC123-DEF456-GHI789")
.WithNodeId(nodeIdProvider)
.WithApplicationInfo(applicationInfoProvider)
.Build();
await OfflineActivationRequestWriter.WriteToFileAsync(request, @"D:\transfer\activation-request.json");

The fingerprint provider is the same one the online flow uses, and the request carries its components, so component matching applies offline too.

The request also names the device, so your customer can tell it apart on the Devices page once the file is activated. By default the name is the computer’s name. Call .WithDeviceName("Plant PC 7") to send a name of your own, or .WithNoDeviceName() to send none. A device activated from a file without a name is listed as “Offline device, activated” and the date.

The C library (liboclavex, a 0.x preview) imports the response but doesn’t write the request. Write the request on the same device with the offline activation sample from the SDK repository (dotnet/samples/OfflineActivationSample). The sample needs the .NET SDK and no other setup:

Terminal window
dotnet run --project dotnet/samples/OfflineActivationSample -- request --code ABC123-DEF456-GHI789 --fingerprint LAB-PC-07 activation-request.json

The request must carry the same fingerprint as your app:

  • If your app calls oclavex_config_set_fingerprint, pass the same value as --fingerprint. The command above is for an app that passes LAB-PC-07.
  • If your app sets no fingerprint, leave --fingerprint out. The sample and the library then both build the fingerprint from the network adapters and the computer’s name. The library keeps the first fingerprint it built, so if a network adapter was added or removed since your app first ran (a laptop’s dock, for example), the two can differ. A fingerprint your app sets avoids this.

The sample prints the fingerprint it wrote. Issue the response, and import it in your app with oclavex_import_offline_response. The library checks the signature and refuses a response issued for another device, as the .NET importer does.

The rest of the offline flow needs no sample: the library writes the usage file and imports the receipt itself, as described in The usage and lease loop.

Either the customer or an operator issues the response. Both run the same checks.

The customer, in the User Portal. A signed-in customer opens Offline activation, uploads the request file, checks the application and device it names, and downloads the signed response. No operator is involved. The server finds the license from the activation code inside the file, and answers only when that license is on the customer’s account (they redeemed its code, were assigned to it, or already activate it on another device); any other code gets 404 license.not_found. The device’s activation belongs to the customer and takes a seat of their license, as an online activation by them would, so it lists under their Devices and a license that needs a signed-in user is satisfied by their sign-in. A request from a hardware key is left to an operator, whose route verifies the key. From your own app, the same call is POST /api/v1/provision/consumer/me/activations/offline/issue with the customer’s own token (ConsumerDeviceApi.IssueOfflineActivationAsync in the SDK).

An operator, in the Provision Portal. Open Offline activation, upload the request file, and download the signed response. From your own backend, the same operation is POST /api/v1/provision/operational/activations/offline/issue. The file carries no user, so the activation is bound to none: a license that needs a signed-in user or a confirmed email address is refused with 403 license.forbidden_by_policy.

The license must have Allow offline activation turned on in its license options (see policies); it is off by default. While it is off, the request is refused with 403 license.forbidden_by_policy and no seat is taken. Online activation of the same license is not affected. Turning it off stops new activations by file; a device that is already activated keeps uploading usage and renewing its lease. To cut it off, disable the entitlement.

A product past its End of life refuses a device that has never activated the license the same way, online and by file, with 403 license.product_end_of_life. A request from a newer version of your application than the license’s maximum version is refused too, online and by file, with 403 license.version_not_supported; the version is the one in the request’s application info.

Submitting a byte-identical request file twice within a short server-side window returns the same signed bytes. Two requests that differ in any field, such as the application instance, are separate requests. A re-export from the device produces a fresh signature. A stronger guarantee holds at the session level: a license takes one seat for each device and application instance. The same device and instance activating again reuses its existing session, so a re-issued response file, however it was produced, never takes a second seat. Two application instances on one device take two seats, online and by file. An instance is named in the request’s application info (applicationInstanceName).

using Revenusion.Oclavex.Client.LicenseConsumer.Features.OfflineActivation;
var importer = new OfflineActivationResponseImporterBuilder()
.WithNodeId(nodeIdProvider) // required: refuses a license issued for another device
.WithActivationCode("ABC123-DEF456-GHI789") // the same code as in the request
.WithApplicationInfo(applicationInfoProvider) // the same application info as in the request
.WithLicenseStore(licenseStore)
.WithPublicKeyProvider(publicKeyProvider)
.Build();
var result = await importer.ImportAsync(@"D:\transfer\activation-response.json");
if (!result.IsSuccess) throw new InvalidOperationException(result.ErrorMessage);

The importer verifies the envelope signature against the pinned public key before touching the license store. A file it refuses (a bad signature, another device’s license, an expired response) comes back as a failed result that says why, not as an exception; on success result.Value is the imported license.

The importer stores the license under the activation code and application info you pass it, as an online activation does. Pass the values the request was built with. At its next start, your application builds the client as it would after an online activation: with the same activation code and application info, and the license store on the same folder. Without a network, the client serves the imported license until its lease ends:

using Revenusion.Oclavex.Client.LicenseConsumer.Services.Store;
using var client = new LicenseClientBuilder()
.UseActivationCode(StaticActivationCodeProvider.Create("ABC123-DEF456-GHI789"))
.UseApplicationInfo(applicationInfoProvider)
.UseNodeId(nodeIdProvider)
.UsePublicKey("<base64 public key>")
.UseLicenseStoreBuilder(store => store.UseLicenseFolderLocation(
LicenseFileStore.LicenseFolderLocation.UserDefined, @"C:\ProgramData\MyApp\License"))
.Build();
var license = await client.Session.AccessLicenseAsync();

A client started with another activation code, application scope or instance name doesn’t use the imported license, and answers sdk.stored_license_for_another_activation, as When the stored license is refused describes. In an ASP.NET Core app, pass the registered ILicenseService to WithLicenseService in place of WithActivationCode and WithApplicationInfo. The importer then stores the license through that service, under the activation code and application info the app runs with, and sessions that are already running see the new license at once.

Air-gapped machines accumulate usage locally (FileTransactionStore). Periodically, swap files again to upload usage and renew the lease:

  1. Export on the device:

    using Revenusion.Oclavex.Client.LicenseConsumer.Services.Store;
    var exporter = new LicenseZipFileExporter(@"D:\transfer\usage-export.zip", licenseStore, transactionStore);
    await exporter.ExportAsync();

    transactionStore is the usage log the client keeps: client.TransactionStore. Choose a file-based one with UseFileTransactionStore(folder) on the builder, so counted usage survives a restart of the device.

    The export carries the records of the license’s own session only, so a record an earlier session left in the log is not sent: it stays on the device, and exporter.LeftBehindTransactionCount says how many.

    A C or C++ app writes the same file with oclavex_export_offline_usage(client, path) (C++: client.export_offline_usage(path)), from the license and the usage log of its client. Set a folder for the usage log with oclavex_config_set_transaction_store_dir, so counted usage survives a restart of the app. When no license is stored on the device, the call returns OCLAVEX_E_NOT_LICENSED and writes no file.

  2. Upload in the portal — Offline activation → Ingest transactions — and download the signed receipt. (API: POST /api/v1/provision/operational/usage/offline/ingest.) The server records the usage, extends the lease, and wraps a refreshed license in the receipt.

  3. Import the receipt on the device:

    using Revenusion.Oclavex.Client.LicenseConsumer.Features.OfflineActivation;
    var importer = new OfflineTransactionReceiptImporterBuilder()
    .WithNodeId(nodeIdProvider) // required: refuses a license issued for another device
    .WithTransactionStore(transactionStore)
    .WithPublicKeyProvider(publicKeyProvider)
    .WithLicenseStore(licenseStore)
    .Build();
    var result = await importer.ImportAsync(@"D:\transfer\usage-receipt.json");

    In an ASP.NET Core app, pass the registered ILicenseService to WithLicenseService in place of WithLicenseStore, as for the activation import. The importer needs one of the two to install the refreshed license.

    It returns the same kind of result as the activation import. On success the refreshed license is installed first, then the uploaded transactions are purged from the local log — if anything fails before the purge, the result is failed and the log stays intact for retry. A C or C++ app imports the receipt with oclavex_import_offline_receipt_file, which also installs the refreshed license before it purges the log.

Repeat the swap on whatever cadence the entitlement’s lease window requires, and an air-gapped fleet stays licensed and metered indefinitely. Re-uploading an export is safe: usage already recorded is not counted twice.

  • Customers can issue their own activation responses in the User Portal. The usage and lease loop (Ingest transactions) is still done by an operator in the Provision Portal.
  • A request file made without a hardware key is checked for format only; its signature is not verified, on either route. A request from a hardware key carries a signature that the operator’s route verifies against the key.
  • The request file is not secret (it contains hashes, not raw device traits), but treat response and receipt files as license material: they’re single-purpose, device-bound, and verified by signature on import.