Skip to content
← All posts
· Delta1 Labs LicensingKeyright

Delegation chains let resellers mint their own keys

You sign a distributor contract and the first integration question is "how do our resellers issue keys to end customers?" The two obvious answers are both wrong: hand each reseller your root signing key and one leaked laptop forges your entire catalogue, or route every reseller sale through a live call to your issuing service and your partners cannot sell when you are down. The design that holds is a delegation chain — give each reseller a signed certificate that carries their own public key and a scope they may never exceed, let them sign end-customer licenses with the private half, and have the client verify the whole chain offline against one pinned root key. This post builds that chain in Keyright: the delegate certificate and its scope, how a reseller issues within it, the SDK verification that walks license to delegate to root, the rule that scope can only ever narrow, and why revoking one certificate silently expires every key a compromised reseller ever issued.

You just signed your first distribution deal. A reseller in another region will sell your .NET product, handle their own customers, issue their own license keys, and remit you a share. The contract is done; the integration question lands the next morning: how do our people actually mint keys?

There are two answers that seem obvious and are both traps.

The first is to hand the reseller your root signing key so they can issue whatever they need. Now every partner laptop holds the key that validates your entire product line, and the day one of them is phished, stolen or simply copied to a personal machine, the attacker can mint a perpetual, every-feature key for any product you sell — and you cannot tell their forgeries from your own signatures, because they are your signature.

The second is to route every reseller sale back through your issuing service: the reseller fills a form, your service signs the key, they hand it on. Nothing leaks, but you have made your partners’ sales desk depend on your uptime and your network path, and a reseller who cannot reach you cannot close a sale.

The design that gives up neither is a delegation chain. This post builds one in Keyright.

What a delegation chain is

Borrow the shape from how TLS certificates work. A root key you keep offline signs a small number of intermediate certificates; those intermediates sign the leaf certificates that servers actually present; and a browser trusts a leaf because it can walk the chain back to a root it pins. The private root almost never has to come out.

Transplanted to licensing, three keys stand in a line:

  • Your root keypair lives on your Keyright instance and signs nothing customer-facing. It signs delegate certificates and that is all.
  • Each reseller holds a delegate keypair. They generate it; they keep the private half; you never see it. You sign a certificate that binds their public half to a scope.
  • The reseller signs end-customer licenses with their delegate private key.

A license issued this way is not a bare token. It is a bundle: the end license, plus the delegate certificate that authorises it, travelling together so the client can verify the whole chain with nothing but the one root public key it already ships.

Minting a delegate certificate

The reseller generates a keypair on their side and sends you only the public half. You mint their certificate with the admin CLI against your instance, stamping it with the scope they are allowed to sell inside:

keyright delegate create \
  --name        "Northwind Distribution GmbH" \
  --public-key  "MCowBQYDK2VwAyEA9r...kQ=" \
  --product     acme-suite \
  --max-expiry  2027-12-31 \
  --allow-entitlement export,max-dpi,seats \
  --max-seats   50 \
  --not-after   2026-12-31

Read the scope carefully, because every field is a ceiling the reseller can never raise:

  • --product pins them to one product line. A delegate for acme-suite cannot sign a key for acme-enterprise.
  • --max-expiry is the furthest-out expiry any license they issue may carry. They can sell a one-year key; they cannot sell a perpetual one.
  • --allow-entitlement is the set of entitlement names they may grant. Anything outside it is dropped at verification, so a reseller cannot quietly enable a feature you reserve for direct sales.
  • --max-seats caps the seat count on any single key they issue.
  • --not-after is the certificate’s own expiry — the delegation itself lapses on this date, independent of the keys issued under it, so a lapsed partner contract stops minting keys automatically.

The service returns the signed certificate. The signature is over the delegate’s public key and the scope together, so neither can be altered without breaking it:

HTTP/1.1 201 Created
Content-Type: application/json

{
  "delegateId": "del_7Qk2",
  "name": "Northwind Distribution GmbH",
  "publicKey": "MCowBQYDK2VwAyEA9r...kQ=",
  "scope": {
    "product": "acme-suite",
    "maxExpiry": "2027-12-31T00:00:00Z",
    "allowEntitlements": ["export", "max-dpi", "seats"],
    "maxSeats": 50
  },
  "notAfter": "2026-12-31T00:00:00Z",
  "signedBy": "root",
  "certificate": "eyJ2IjoxLCJkZWxlZ2F0ZUlkIjoiZGVsXzdRazIi...<signed>"
}

That certificate string is what the reseller embeds in every license they issue. You keep nothing secret of theirs; they keep nothing secret of yours.

Delegation chain: root signs the delegate, the delegate signs the keyRoot keypairon your instancesigns delegatecerts onlyDelegate certificatereseller public keyproduct: acme-suitemaxExpiry: 2027-12-31allow: export, seatsmaxSeats: 50signedBy: rootEnd-customer licenselicensee: acct_8f21expiry: 2027-03-01export=true, seats=10signedBy: del_7Qk2+ delegate cert(bundled)signssignsWhat the client does with only the pinned root public key1. verify the end license against the delegate public key in the bundle2. verify the delegate certificate against the pinned root public key3. clamp the license to the scope — expiry, entitlements and seats may only narrowThe root private key never signs a customer key, so it never has to leave the instance.

The reseller issues within scope

The reseller runs their own small issuing step — a CLI on their sales desk, or a thin service of their own — signing with the delegate private key. They never call your instance to close a sale:

keyright issue \
  --delegate-cert   ./northwind.cert \
  --delegate-key    ./northwind.key \
  --licensee        acct_8f21 \
  --expiry          2027-03-01 \
  --entitlement     export=true \
  --entitlement     seats=10

The output is the bundle — end license and delegate certificate concatenated into one .lic blob the customer activates exactly like any other key. If the reseller tries to overreach — --expiry 2030-01-01, past their maxExpiry, or --entitlement watermark=false, which is not in their allowed set — the sensible issuer rejects it locally. But local rejection is a convenience, not the guarantee. The guarantee lives on the client, which re-checks everything regardless of what the reseller’s tool did or did not allow.

The client verifies the chain

On the customer’s machine the SDK is configured with one thing that matters: the root public key. Not the reseller’s — the root’s. That single pin is what lets the client trust a key signed by a partner it has never heard of.

static readonly KeyrightClient License = KeyrightClient.Initialize(new KeyrightOptions
{
    Product             = "acme-suite",
    RootPublicKeyBase64 = AcmeKeys.RootPublicKey,   // the ROOT, pinned in the app
    ServiceUrl          = "https://licensing.acme.example",
});

LicenseInfo info = License.Validate();

Validate() walks the chain inside the bundle:

  1. It reads the delegate certificate and verifies the end license’s signature against the delegate public key the certificate carries.
  2. It verifies the delegate certificate’s signature against the pinned root public key — and refuses if the certificate’s notAfter has passed.
  3. It then clamps the license to the certificate’s scope before it reports anything: the effective expiry is the earlier of the license expiry and the delegate’s maxExpiry; any entitlement not in allowEntitlements is treated as unset; the seat count is capped at maxSeats.

Only a license that is signed by a delegate, whose delegate is signed by your root, and that sits entirely inside its scope, comes back valid. From there your app gates exactly as it always has — info.IsValid, then the entitlements:

if (!info.IsValid) { RunEvaluation(info); return; }

if (License.IsEnabled("export")) EnableExport();
int seats = (int)License.GetLimit("seats", fallback: 1);

// Who issued it — useful for support and telemetry, never for the gate itself.
Log.Information("Licensed via {Delegate}", info.IssuedBy);   // "del_7Qk2"

The customer never knows or cares that a reseller signed their key. The chain is an implementation detail of trust; the gate they hit is the same one a direct customer hits.

Scope can only ever narrow

This is the property that makes delegation safe, and it is worth saying plainly: nothing down the chain can grant more than its parent allowed. The clamp in step 3 is not advisory — it is the whole security model. A reseller who edits their issuer to stamp maxExpiry: 2099 onto a key gains nothing, because the client takes the minimum of the license expiry and the scope’s maxExpiry, and the scope is inside the certificate, and the certificate is signed by your root. One changed byte in the scope breaks the root’s signature and the chain fails closed at step 2.

So the worst a fully compromised reseller key can do is issue keys inside the scope you already granted them — one product, bounded expiry, a fixed entitlement set, a seat ceiling. That is a bad day. It is not a catastrophe, and it is not forgeable into your other products. Compare that to the first trap, where a leaked root key is the catastrophe, full stop.

Revocation that propagates

Because every end license in the field carries the certificate it descends from, you have a kill switch at the certificate level. If a reseller’s key is compromised — or the contract ends, or they are caught over-issuing — you revoke the delegate, one entry, and every license that reseller ever signed stops validating on its next grace-window revalidation:

keyright delegate revoke del_7Qk2 --reason "partner contract ended"

The client learns the delegate is revoked the same way it learns an individual key is — through the revocation list it already pulls — and fails the chain at the delegate link. You do not have to know which end customers that reseller sold to, or chase down individual keys; cutting the branch drops every leaf on it. For a clean partner wind-down you would usually also let notAfter lapse rather than hard-revoke, so existing customers ride out their terms while no new keys can be minted.

Testing the chain

The test that earns its place is the overreach test — prove the client refuses to honour a scope violation even when the reseller’s signature is perfectly valid:

[Fact]
public void Client_clamps_a_license_that_exceeds_its_delegate_scope()
{
    var root     = TestRoot.Create();
    var delegate_ = root.MintDelegate(product: "acme-suite",
                       maxExpiry: new DateTime(2027, 12, 31), maxSeats: 50,
                       allow: new[] { "export", "seats" });

    // A validly-signed key that asks for more than the scope allows.
    string bundle = delegate_.Issue(licensee: "acct_8f21",
                       expiry: new DateTime(2099, 1, 1),   // past maxExpiry
                       entitlements: new() { ["seats"] = 500 });  // past maxSeats

    var client = KeyrightClient.Initialize(new KeyrightOptions
        { Product = "acme-suite", RootPublicKeyBase64 = root.PublicKeyBase64,
          LicenseBlob = bundle });

    var info = client.Validate();

    Assert.True(info.IsValid);                                  // chain is well-formed
    Assert.True(info.Expiry <= new DateTime(2027, 12, 31));     // expiry clamped to scope
    Assert.Equal(50, client.GetLimit("seats", fallback: 1));    // seats clamped to scope
}

Pair it with the inverse — a key inside scope validates and keeps its own, smaller numbers — and a third that revokes the delegate and asserts the chain then fails closed. A fake in-memory issuing service lets you mint test roots, delegates and leaves without touching your real instance.

The takeaway

Resellers need to mint keys; you need to never hand out your root key and never make your partners depend on your uptime to sell. A delegation chain gives you both. Sign each reseller a certificate that binds their public key to a scope that is a hard ceiling — one product, a maximum expiry, an allowed entitlement set, a seat cap, and an expiry on the delegation itself. Let them sign end-customer keys offline with the private half. Ship only the root public key in your app, and let the SDK walk license → delegate → root and clamp every key to its scope before it reports valid. Scope can only narrow, so a compromised partner is bounded, not catastrophic; and because every key carries its parent certificate, revoking one delegate retires every key beneath it without your ever knowing the customer list. That is how you let a hundred resellers issue keys and still hold exactly one key that matters.

Try Nebula.NET

Harden your .NET code in minutes — start with the free edition.