Skip to content
← All posts
· Delta1 Labs PrivacyKeyright

Erase licensee PII without breaking issued keys

How to honor a GDPR Article 17 erasure request against a Keyright issuing store — crypto-shredding the licensee's name and email while the signed license tokens already in customers' hands stay valid and the hash-chained audit trail stays intact.

A data-subject erasure request is a deadline, not a feature request. Someone emails your support alias citing GDPR Article 17, and within a month you must erase their personal data or document why you cannot. For a software vendor the uncomfortable question is: their licence is the thing they paid for — if I erase them, do I break it? If your licensing store glued the customer’s email into the signed key, the honest answer is that you cannot erase it at all: the key is in their hands and you cannot reach it. This post shows how Keyright is built so that answer is never necessary.

The real question: what is personal, and where does it live

An erasure request targets personal data — a name, an email, a company contact. It does not target the licence grant itself, which is a record of a lawful transaction you are entitled (and often legally required) to keep. So the whole problem reduces to one design decision: keep personal data out of the signed artifact and in a store you control.

A Keyright licence token is a signed, self-contained claim set that the customer’s application verifies offline:

var verifier = new LicenseVerifier(publicKey);
LicenseClaims claims = verifier.Verify(tokenBytes).Claims;

Console.WriteLine(claims.Subject);      // "KR-9QX2M7"  — pseudonymous, stable
Console.WriteLine(claims.DisplayName);  // "Acme Studio — Site A"  — vendor-chosen label
Console.WriteLine(string.Join(",", claims.Entitlements)); // "studio.pro,export.batch"

Notice what is not there. There is no email, no contactName, no raw company registration. The Subject is an opaque, stable id — the same KR-9QX2M7 that appears in the audit trail — and the DisplayName is a label the vendor chose, not a data subject’s own identity. Everything a human would call “personal data” lives on the other side of that boundary, in the issuing store, keyed by the subject.

Customer's hands (immutable) signed token sub: KR-9QX2M7 display: Acme — Site A ent: studio.pro sig: valid ✓ (offline) Issuing store (you control) licensee_profiles email_cipher, name_cipher data_key_id → 3f10… licensee_keys (3f10…) erase = DELETE this row Audit (append-only) hash-chained log … licensee.erased sub: KR-9QX2M7 reason: DSAR-0417 no PII, prevHash ✓ Delete the data key → ciphertext is unrecoverable. The token still verifies; the chain stays intact.
PII lives only in the store, sealed by a per-licensee key. Erasure deletes the key, not the licence.

Crypto-shredding: how one DELETE erases a licensee

You could run UPDATE licensee_profiles SET email = NULL and call it a day, but that is fragile: PII leaks into backups, read replicas, and anything that logged the row. The robust pattern is crypto-shredding — store every personal field as ciphertext sealed by a key that belongs to exactly one licensee, and erase by destroying the key. Once the key is gone the ciphertext is indistinguishable from noise everywhere it was ever copied, including in last week’s backup.

On the write path, each sensitive field is sealed with the licensee’s own data key:

public sealed record LicenseeProfile(
    string Subject,       // "KR-9QX2M7" — pseudonymous, never erased
    byte[] EmailCipher,
    byte[] NameCipher,
    Guid   DataKeyId);    // FK into licensee_keys

static byte[] Seal(byte[] dataKey, string plaintext)
{
    Span<byte> nonce = stackalloc byte[12];
    RandomNumberGenerator.Fill(nonce);
    var pt = Encoding.UTF8.GetBytes(plaintext);
    var ct = new byte[pt.Length];
    var tag = new byte[16];
    using var aes = new AesGcm(dataKey, tag.Length);
    aes.Encrypt(nonce, pt, ct, tag);
    return Concat(nonce, tag, ct);   // store nonce‖tag‖ciphertext
}

Erasure is then a single, auditable transaction: delete the key row, overwrite the profile’s direct identifiers with a tombstone, and append the fact to the audit chain. Keyright runs exactly this when you call the admin endpoint:

POST /v1/admin/licensees/KR-9QX2M7/erase
Content-Type: application/json

{ "reason": "DSAR-2026-0417", "confirm": "KR-9QX2M7" }

Server-side, the three steps are one unit of work so a crash cannot leave a half-erased record:

await using var tx = await db.BeginTransactionAsync();

// 1. Shred: destroy the only key that can decrypt this licensee's fields.
await db.ExecuteAsync(
    "DELETE FROM licensee_keys WHERE id = @k", new { k = profile.DataKeyId }, tx);

// 2. Tombstone the direct identifiers that are not themselves encrypted.
await db.ExecuteAsync(
    "UPDATE licensee_profiles SET email_cipher = NULL, name_cipher = NULL, " +
    "erased_at = now() WHERE subject = @s", new { s = subject }, tx);

// 3. Seal the compliance record into the hash chain (no PII in it).
await audit.AppendAsync(new AuditEntry(
    Action:  "licensee.erased",
    Subject: subject,                 // pseudonymous — safe to keep
    Actor:   operatorId,
    Meta:    new { reason = "DSAR-2026-0417" }), tx);

await tx.CommitAsync();

The same operation is available from the CLI for operators handling tickets, and it refuses to run without an explicit confirmation of the subject so a fat-fingered id cannot erase the wrong customer:

keyright licensee erase --subject KR-9QX2M7 --reason "DSAR-2026-0417" --confirm KR-9QX2M7

Satisfying access and portability first

Article 17 rarely arrives alone. A subject usually asks to see their data (Article 15) or take it with them (Article 20) before, or instead of, erasing it. Keyright exposes the same subject boundary for export — it gathers every record that references the subject and returns a portable document:

keyright licensee export --subject KR-9QX2M7 --out dsar.json
{
  "subject": "KR-9QX2M7",
  "profile": { "name": "…", "email": "…", "company": "…" },
  "licenses": [
    { "id": "lic_7f3a9c2e", "product": "acme-studio",
      "display_name": "Acme Studio — Site A", "status": "active" }
  ],
  "activations": [
    { "machine": "host-7e2", "first_seen": "2026-03-11T08:21Z" }
  ],
  "exported_at": "2026-11-18T09:00:00Z"
}

Run the export before the erase and attach it to the ticket: you have now satisfied access, portability, and erasure from one pseudonymous key, and you have a dated artifact proving what you handed over. The licence rows themselves stay in the export as transaction records, but after erasure their decrypted contact fields are gone — the display_name that remains is the label you chose, not the subject’s identity.

When it breaks — the honest caveats

Old tokens that embedded PII. The whole scheme depends on the token carrying a pseudonymous subject. If an earlier, home-grown system minted keys with the customer’s email as a human-readable field, those keys are beyond reach — you do not hold them and cannot re-sign them. The only remedies are to let them expire or to add them to the revocation blocklist and re-issue clean ones; neither retroactively scrubs the copy the customer already has. Migrating such a scheme is a reason to move the identity out of the token now.

Erasure is not revocation. Deleting a licensee’s PII deliberately leaves the licence working. If the request is also a demand to stop service, that is a separate revoke call with its own lawful-basis question — do not conflate the two, and do not let an erasure quietly cancel a paid entitlement.

Backups and the shred window. Crypto-shredding makes ciphertext unrecoverable the instant the key is gone, which is its great advantage over DELETE — but only if the key was never stored in a form that outlives the key row. Keep data keys in the key table and nowhere else; if a key is ever dumped into a log line, the shred no longer bites on that copy.

Audit retention. The hash-chained entry you keep contains only the pseudonymous subject, the operator, the reason reference and a timestamp. That is lawful to retain — it is the evidence of compliance — but it is also why the subject must be a pseudonym and never the email: an audit log you cannot erase must never have held personal data in the first place.

Takeaway

GDPR erasure is survivable precisely when you decide, before the first key is issued, that the signed artifact carries a pseudonym and the personal data lives in a store you control, sealed by a key you can destroy. Then an Article 17 request is a single transaction — shred the key, tombstone the record, seal the fact into the chain — and the customer’s licence keeps verifying offline as if nothing happened, because from the token’s point of view, nothing did. See the Keyright privacy and audit docs for the admin API and CLI reference.

Try Nebula.NET

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