Activate a license on an air-gapped machine
Secure and regulated environments run .NET apps on machines that will never touch the internet, so the usual online activation call is impossible. This post shows the offline challenge-response design Keyright uses: the client emits a signed activation request blob carrying its fingerprint, a nonce and the product/seat; an operator carries it out-of-band to the issuing service, which returns a signed response bound to that exact nonce and fingerprint; and the SDK verifies the vendor signature offline before installing. Real C# with ECDsa P-256, the nonce-and-expiry replay defense, fingerprint binding, and periodic re-confirmation for long-lived offline installs.
A hospital’s imaging workstation, a utility’s control-room server, a defense contractor’s build box: plenty of real .NET software runs on machines that will never be allowed to open a socket to your issuing service. The network is the threat model those environments are built to remove. Your online activation call — the one that POSTs a license key and gets back a signed entitlement — simply cannot run there, and “just whitelist our endpoint” is not an answer a regulated operator is allowed to give.
The real question
Offline activation is usually bolted on as a weaker mode: print a key, type it in, trust it. That throws away everything node-locking gave you. The real question is whether you can keep the full strength of online activation — the license bound to this machine, no replay, no one blob unlocking a hundred boxes — when the only channel between the machine and the server is a human carrying a file on a USB stick.
You can. The trick is to run the same challenge-response handshake you run online, but split it across the air gap and move each half by hand. The machine emits a request; a person carries it to the server; the server mints a response; the person carries it back. Everything that makes the online handshake safe — a fresh nonce, a fingerprint binding, an asymmetric signature — survives the trip, because none of it needs the two sides to be connected at the same instant.
The request envelope
The air-gapped client builds a small, self-describing request. It carries the machine fingerprint, the product and seat being claimed, a freshly generated nonce, and a creation timestamp. The client keeps the nonce; it will refuse any response that does not echo it.
public sealed record ActivationRequest
{
public int SchemaVersion { get; init; } = 1;
public string LicenseKey { get; init; } = "";
public string Product { get; init; } = "";
public string Seat { get; init; } = "";
public string MachineFingerprint { get; init; } = "";
public string Nonce { get; init; } = ""; // client-generated, single use
public DateTimeOffset CreatedAt { get; init; }
}
// On the air-gapped machine.
var request = new ActivationRequest
{
LicenseKey = userEnteredKey,
Product = "acme-suite",
Seat = "ct-console-7",
MachineFingerprint = _fingerprint.Compute(), // stable per-machine hash
Nonce = Convert.ToBase64String(RandomNumberGenerator.GetBytes(32)),
CreatedAt = DateTimeOffset.UtcNow,
};
_pending.Save(request); // remember the nonce for later
File.WriteAllText("activation-request.k7r", Envelope.Serialize(request));
That .k7r file is the blob the operator carries. It contains no secret: a fingerprint is a hash of the machine, the nonce is a random token, and the license key is one the customer already holds. Losing it to an eavesdropper costs nothing, because nothing in it can be turned into a working license without the vendor’s private key.
The response envelope
On the connected side, the issuing service opens the request, looks up the license, decides whether this seat may activate, and mints a response. The response echoes the nonce and fingerprint from the request, adds the entitlements and expiry, adds a ConfirmBy deadline for re-confirmation, and is signed by the vendor key.
// Issuing service (online side of the gap).
ActivationRequest req = Envelope.Deserialize<ActivationRequest>(blob);
if (!_seats.TryClaim(req.LicenseKey, req.Seat, req.MachineFingerprint))
throw new LicenseException("seat unavailable or license revoked");
var response = new ActivationResponse
{
Nonce = req.Nonce, // bind to THIS request
MachineFingerprint = req.MachineFingerprint, // bind to THIS machine
Product = req.Product,
Seat = req.Seat,
Entitlements = new[] { "core", "dicom-export" },
ExpiresAt = DateTimeOffset.UtcNow.AddYears(1),
ConfirmBy = DateTimeOffset.UtcNow.AddDays(90), // re-confirmation deadline
NotAfter = DateTimeOffset.UtcNow.AddDays(14), // install-by window for the blob
};
byte[] payload = Envelope.CanonicalBytes(response);
response = response with { Signature = _vendorKey.SignData(payload, HashAlgorithmName.SHA256) };
File.WriteAllText("activation-response.k7r", Envelope.Serialize(response));
The NotAfter field is a short window — the blob must be installed within two weeks of minting, independent of the license’s own year-long expiry. It closes the gap between “we decided this seat may activate” and “the machine actually installed it”: a response that sits on a shelf for a month is dead, so a stolen blob is only dangerous for a short, bounded time.
Verifying offline
Back on the air-gapped machine, the SDK verifies with no network and no secret. It holds the vendor public key compiled in, checks the signature over the canonical payload, then checks the two bindings and the window. Any failure means refuse — there is no “trust it anyway” branch.
// Air-gapped machine, no connectivity.
ActivationResponse resp = Envelope.Deserialize<ActivationResponse>(blob);
byte[] payload = Envelope.CanonicalBytes(resp with { Signature = null });
if (!_vendorPublicKey.VerifyData(payload, resp.Signature, HashAlgorithmName.SHA256))
throw new LicenseException("response not signed by the vendor");
ActivationRequest pending = _pending.Load()
?? throw new LicenseException("no activation request is pending on this machine");
if (resp.Nonce != pending.Nonce)
throw new LicenseException("response does not match the pending request"); // replay
if (resp.MachineFingerprint != _fingerprint.Compute())
throw new LicenseException("response was issued for a different machine"); // wrong box
if (DateTimeOffset.UtcNow > resp.NotAfter)
throw new LicenseException("activation blob expired before it was installed");
_store.Install(resp); // persist the entitlement, clear the pending nonce
_pending.Clear();
Signing over a canonical byte form matters as much here as online: the verifier must reconstruct the exact bytes the signer hashed, with fields in a fixed order and no incidental whitespace, or valid responses fail verification. That is the same discipline described in canonical serialization for license signatures; offline it is unforgiving because there is no server to retry against.
Use ECDsa P-256 (System.Security.Cryptography.ECDsa) for both the signing on the service and the verifying in the SDK — it is in the BCL, works under Native AOT and trimming, and needs no third-party dependency on a locked-down machine. The vendor key that signs responses is the same asymmetry you already use for license envelopes; the air gap changes the transport, not the cryptography.
Re-confirmation keeps offline honest
The one thing an air-gapped install can never do is hear that its seat was revoked. The ConfirmBy date is the answer. The installed entitlement is valid only until that date; the SDK treats a past ConfirmBy as expiry and fails closed, which forces the operator to carry a new request out and a new response back. Re-confirmation is just activation run again: the client emits a fresh request with a new nonce, the service either mints a new response or — if the seat was revoked, the license lapsed, or the machine was decommissioned — declines. Revocation therefore takes effect at the next confirmation rather than instantly, and you choose the window: a long interval for a stable regulated box, a short one where seats move between machines.
When it breaks
This defends the blobs, not the clock. An air-gapped machine’s system time is attacker-controllable; rolling it back defeats both NotAfter and ConfirmBy. Pair the dates with a monotonic high-water mark so time cannot move backward across runs, as in anti-rollback with a license epoch. The scheme also assumes the operator’s workflow is trusted end to end; if someone can quietly swap the request blob before it reaches the service, they can claim a seat for a machine they chose, so treat the out-of-band channel as part of the trust boundary. And like every license check, none of it survives a patched binary that skips verification — pair fail-closed enforcement with obfuscation of the verification path using Nebula.NET.
Takeaway
Offline activation does not have to be the weak cousin of the online flow. Run the identical challenge-response handshake, carry each half across the gap by hand, and put every safety property — the nonce, the fingerprint binding, the install window, the re-confirmation deadline — inside a vendor-signed blob the machine can verify with a compiled-in public key and no network. The machine that never touches the internet still gets a license bound to it alone, replay-proof, and revocable at a bounded interval.
Keyright is a self-hosted .NET licensing system — an issuing service plus SDK — with a free Community Edition. Offline activation and the request/response envelopes are covered in the Keyright docs; for the online handshake this mirrors, see proof of possession with a device key.
Try Nebula.NET
Harden your .NET code in minutes — start with the free edition.