DRAFT 0.1.0-draft Everything here is a draft and unreviewed. Nothing is ready for production use. Status and roadmap

Specification · CCSAX-0005

Key hierarchy

The key words in this document are to be interpreted as described in BCP 14 [RFC 2119] [RFC 8174] when, and only when, they appear in all capitals.

1. Overview

Root key R (kid "root", versions 1..n)       — KMS/HSM in production; a protected file only in v0 / tests
   │  seals (CEF direct mode, purpose "ccsax/kek")
   ▼
Tenant KEK  K_t,v  (random 32 bytes, one kid per tenant, versions 1..n)
   │  wraps (CEF wrap suite CCSAX-S1)            │ derives (deriveSubkey, §4)
   ▼                                             ▼
DEK per object / batch (random, inside CEF)     purpose subkeys (e.g. CCSAX-T1 MAC key)

Recipient key pairs (CCSAX-H1) sit beside tenant KEKs: DEKs can be wrapped to a public key
(e.g. for an offline escrow or a separate service) without that party holding the KEK.

2. Key objects

Every key has: kid ([A-Za-z0-9._:-]{1,64}, opaque, no personal data), kv (0..2^32−1), the single suite it is bound to (CCSAX-S1 for symmetric keys, CCSAX-H1 for X-Wing key pairs) and a status:

Status Seal / wrap Open / unwrap
active yes yes
decrypt-only no yes (result flagged needsMigration)
destroyed — — (key material gone)

A key MUST be used with exactly one suite (key–suite binding). An implementation MUST refuse to use a key with any other suite, even if the bytes would fit (CCSAX-0006 §4).

At most one version of a kid SHOULD be active at a time.

3. Root key and tenant KEKs

  • The root key is 32 random bytes. In production it SHOULD live in a KMS or HSM, and sealing / opening of tenant KEKs SHOULD happen there. In v0 a file is acceptable for development only; it MUST be readable by the service account alone and MUST NOT be committed to source control.

  • Tenant KEKs are random, not derived from the root. They are stored sealed:

    sealed_K_t,v = CEF-Seal-Direct(R, K_t,v, context = { tenant: t, purpose: "ccsax/kek", object: kid || "#" || kv })
    

    Because the context binds tenant, kid and kv, a sealed KEK copied to another tenant or relabelled with another version fails to open.

  • Random (rather than derived) KEKs are what makes per-tenant crypto-shredding possible (§6): if KEKs were HKDF outputs of R, destroying one would be meaningless while R exists.

4. Purpose separation and label registry

Purpose-separated subkeys for non-CEF uses:

deriveSubkey(K, purpose, L = 32) = HKDF(salt = "ccsax/v1/subkey", ikm = K, info = "ccsax/v1/" || purpose, L)
purpose matches ^[a-z0-9][a-z0-9._-]{0,63}$ ;  16 ≤ L ≤ 64

CEF does not use deriveSubkey: its own derivations already bind the context (and thus the purpose).

All labels (HKDF salts, info prefixes, AAD prefixes) are registered here. Every label starts with ccsax/v1/. New labels require a CEP.

Label Use Defined in
ccsax/v1/cef/S1 HKDF salt, CEF data keys CCSAX-0003 §6.1
ccsax/v1/cef/S1/data-keys HKDF info prefix, CEF data keys CCSAX-0003 §6.1
ccsax/v1/cef/aad data AAD prefix CCSAX-0003 §6.4
ccsax/v1/cef/wrap/<alg> HKDF salt, wrap key (<alg> = suite id) CCSAX-0003 §7.1
ccsax/v1/cef/wrap/<alg>/key HKDF info prefix, wrap key CCSAX-0003 §7.1
ccsax/v1/cef/wrap-aad wrap AAD prefix CCSAX-0003 §7.1
ccsax/v1/subkey HKDF salt for deriveSubkey this document
ccsax/v1/<purpose> HKDF info for deriveSubkey this document
ccsax/v1/t1.token-mac CCSAX-T1 MAC key (via deriveSubkey) CCSAX-0004
ccsax/v1/test-drbg TEST ONLY deterministic generator for vectors impl/ts/src/rng.ts
ccsax/kek reserved CEF context purpose for sealed KEKs this document §3

Labels for different uses are distinct and none is a prefix of another within the same field in a way that creates ambiguity: every info string is label || 0x00 || fixed-length fields or a label alone.

5. Rotation without downtime

  1. Generate version kv+1 as active; mark all older versions decrypt-only. Publish the change (CVL event key.rotate, CCSAX-0007).
  2. New envelopes use kv+1 immediately. Old envelopes keep opening and report needsMigration.
  3. Migrate lazily or in the background (CCSAX-0006): wrapped-mode envelopes by rewrap (CCSAX-0003 §7.4: only the wrap block changes, ciphertext untouched), direct-mode envelopes by re-encryption.
  4. When the inventory shows no data left under an old version, mark it destroyed.

Triggers: scheduled (RECOMMENDED at least yearly for KEKs), budget (well before 2^32 S1 invocations, CCSAX-0003 §6.3), suite deprecation, or suspected compromise (immediately; and for compromise, rewrap is not sufficient for envelopes whose DEK may have been exposed: those MUST be re-encrypted).

6. Crypto-shredding

To make a tenant's data permanently unreadable, destroy every version of that tenant's KEK: the sealed KEK records, any cached plaintext copies, KMS replicas and backups that contain them. Then every wrapped DEK of that tenant is undecryptable.

  • This only holds if (a) no copy of the KEK survives anywhere, (b) the data was never stored under a key shared with other tenants, and (c) no DEK or plaintext was copied elsewhere. Backups are the usual failure: backup retention MUST be part of the shredding procedure.
  • Direct-mode envelopes under the tenant KEK are shredded the same way.
  • Record a CVL event key.destroy with kid and versions (no key material).

7. Security considerations

  • Root compromise exposes every tenant KEK, hence everything. Keep R in a KMS/HSM with audit logs; use separate roots per environment (production, staging, test).
  • KEK compromise exposes that tenant's DEKs. Rotate and re-encrypt (not just rewrap).
  • An attacker able to write the key store can substitute keys; protect key stores with access control and log every lifecycle change (CVL).
  • JavaScript cannot guarantee erasure of key material; prefer KMS-side operations in production.

8. References

  • [RFC 2119], [RFC 8174]; [RFC 5869] HKDF; NIST SP 800-57 Part 1 Rev. 5, "Recommendation for Key Management: Part 1 – General", May 2020 (key states and cryptoperiods, informative).
  • CCSAX-0003 (CEF), CCSAX-0004 (suites), CCSAX-0006 (migration), CCSAX-0007 (CVL).