Cryptographic Boundary
The cryptographic boundary defines the surface across which key material moves — where keys are generated, where plaintext is held, how it crosses the wire, and who is cryptographically capable of seeing it. Every plaintext exposure is a potential breach; the threat surface is the catalogue of every place a plaintext key or payload could leak, and the bound the platform places on each.
Kibo, the platform's cryptographic kernel, treats plaintext key material as strictly sequestered — held only inside the locus that the request's chosen strategy permits, with hard transit and lifetime bounds. The boundary is enforced cryptographically, not by trusting the code to behave.
1. Scope
This surface defends against:
| Threat class | Example |
|---|---|
| Plaintext key leakage | A bug, log line, or crash dump that exposes a plaintext DEK or CEK outside the secure boundary |
| Key exfiltration via storage | An attacker reading persistent storage and recovering plaintext keys |
| MITM during transmission | An attacker interposing on the channel between Kibo and a customer's KMS during wrap or unwrap |
| Gateway plaintext exposure | The gateway, which relays cryptographic requests, observing the plaintext DEK it forwards |
| Posture downgrade | An attacker tampering with a stored envelope to silently route decryption through a weaker strategy or tier than it was sealed under |
| Ciphertext substitution | A valid ciphertext from one context being replayed in another to coerce an unintended decryption |
| Historical-version exposure | An attacker who later compromises an old CEK recovering ciphertext DEKs that were not re-wrapped after rotation |
| Nonce reuse | A cloned or restarted VM re-emitting a nonce and leaking a relationship between two ciphertexts |
This surface does not address:
- Key compromise outside the platform (a customer's CEK stolen from their KMS) — a customer-controlled lifecycle; Kibo's role is to honour revocation and re-wrap on rotation.
- Cryptographic primitive weakness — AES-256-GCM-SIV, RSA-4096, P-384 are presumed sound; the threat surface assumes the algorithms hold.
- TEE compromise itself — covered by the Infrastructure surface; this boundary assumes TEE memory protection holds.
2. The key hierarchy
Every encrypted object is protected through envelope encryption with three distinct layers:
_MK is the regional master key. The platform-managed regional custody chain is rooted in a FIPS 140-3 Level 3 HSM-backed regional master key — the hardware root each region's CEKs wrap under. The per-project CEK itself remains a region-pinned, software-protected secret; the HSM property belongs to the shared regional master key, not to the per-project CEK.
The DEK's AEAD is AES-256-GCM-SIV (nonce-misuse-resistant). The choice is load-bearing for this surface: a confidential VM can be cloned, snapshotted, or scaled horizontally, and any of those can re-emit a nonce. Under plain GCM a repeated nonce is catastrophic; under GCM-SIV it is not — the worst case degrades to leaking only whether two plaintexts were identical. The platform also caps per-DEK invocations and persists the counter (see §4) as defence-in-depth, not as the thing standing between you and disaster.
The CEK never enters a Kibo-operated process under BYOK or HYOK — every CEK operation happens inside the customer's KMS over an attested channel.
3. Where encryption runs: the three strategies
The boundary's shape depends on where the cryptography executes. Kibo exposes a single encrypt/decrypt pair, but it routes across a closed, version-tagged set of three strategies — and an orthogonal attestation tier describing how the executing environment is protected.
| Strategy | Where the DEK is unwrapped | Boundary guarantee |
|---|---|---|
LOCAL_ENVELOPE | In Kibo's attested compute, or — for BYOK/HYOK — on the customer's own device | Default. Kibo-attestable; for BYOK/HYOK the plaintext DEK is reconstructed only in the customer's trust domain |
KIBO_VAULT_ORACLE | In the sovereign vault | Explicit opt-in. Puts the plaintext DEK in Kibo's data path; reaches zero-knowledge only on a confidential-compute tier (below) |
CUSTOMER_KMS_ORACLE | In the customer's own KMS/HSM | Explicit "maximum sovereignty" opt-in. Kibo holds neither the plaintext DEK nor the KEK |
The attestation tier — tdx, sev-snp, hardened, or standard — is a separate axis describing the protection of whichever environment runs the crypto. It is not a fourth strategy.
The binding rule: route on trust posture first, payload size second — never size alone. A switch made only on size would silently change the sovereignty guarantee, and zero-key-exposure is not the same property as zero-knowledge. Within a band that is already zero-knowledge (BYOK/HYOK), size-based routing is safe; across postures it is never automatic. An explicit strategy is honour-or-reject — the platform never silently substitutes a weaker one.
4. Plaintext lifetime: TTL and zeroing
Where a plaintext DEK is held inside Kibo's compute, it lives only as long as needed. The cache enforces a layered set of eviction bounds:
| Bound | Behaviour at limit |
|---|---|
| Time-to-live | Entry evicted on TTL expiry; next operation re-fetches |
| Bytes encrypted | Entry evicted after the per-DEK byte ceiling; a new DEK is generated for subsequent traffic |
| Operation count | Entry evicted after the per-DEK operation-count ceiling (counter persisted across reloads, not reset to zero) |
| Workload lifetime | Per-workload TEE encryption key destroyed on restart; all cached DEKs cryptographically destroyed in the same step |
All four bounds are configurable per the project's custody policy.
Eviction is not free of cost — the memory is zeroed, not merely freed, using explicit zeroing primitives (zeroize in Rust, explicit_bzero in C, equivalent in the runtime) so that a later memory-inspection attack cannot recover the bytes from a freelist or garbage-collected slab. The TTL bound is the blast-radius limiter: an attack that succeeds at second T extracts at most the DEKs cached at T — a bounded window, not indefinite access.
5. Zero-knowledge: gateway-blindness and operator-blindness
"Zero-knowledge" means the provider is cryptographically incapable of seeing plaintext — and it decomposes into two orthogonal properties the platform treats separately.
Gateway-blindness (software). The SDK seals each wrap/unwrap request to the sovereign vault with HPKE (RFC 9180). The gateway that relays the request forwards an opaque blob it cannot open — closing the residual window in which a relay component momentarily handled a plaintext DEK. This holds in software, across every custody mode.
Operator-blindness (who is in the unwrap path). This is what separates the strategies:
- With your own key (BYOK/HYOK) — the unwrap happens client-side, in your KMS/HSM. Kibo stores only the wrapped DEK and the ciphertext; it holds neither the plaintext DEK nor the KEK. This is zero-knowledge with your own key, and it needs no special hardware.
- For platform-managed keys — operator-blindness requires the vault to run inside a confidential-compute enclave (TDX / SEV-SNP), with the HPKE key bound to a verified enclave quote. On an attested confidential-compute tier the operator is cryptographically blind; on the hardened tier the guarantee is operational, enforced by network position, service-account scoping, and the audit ledger rather than by silicon.
Two claims this page makes precisely, because the difference is load-bearing: the KEK never leaves the sovereign infrastructure in every deployment; it never leaves your infrastructure only under BYOK/HYOK. Confidential-compute guarantees are stated per deployment mode — they hold where an attested enclave is the execution environment, not as a blanket property of the platform.
6. Anti-substitution: AAD binding and encryption context
Two authenticated bindings keep a sealed object from being silently re-interpreted. Both ride the AEAD's additional authenticated data (AAD) channel — data that is not encrypted but is fused into the authentication tag, so any change to it makes decryption fail outright.
Posture binding. Every envelope carries {version, strategy, attestation_tier} bound as AAD. On decrypt, the platform verifies the bound strategy and tier against the path it is about to route through; a mismatch is a hard failure. This blocks a posture-downgrade attack that tampers with a stored tag to route decryption through a weaker locus than the data was sealed under.
Encryption context. Callers may bind an optional encryptionContext — a set of non-secret, plaintext key-value pairs (tenant, record, purpose) that tie a ciphertext to where it legitimately belongs. The pairs are injected into the AES-256-GCM-SIV computation as AAD and fused into the authentication tag; they hide nothing, but they make the ciphertext refuse to decrypt anywhere its context does not match.
Why it earns its place — a worked example. Suppose an application stores encrypted account balances keyed by user:
{ "user_id": "alice_123", "encrypted_balance": "…" } // $10,000
{ "user_id": "mallory_999", "encrypted_balance": "…" } // $5
Without an encryption context, a ciphertext is portable. An attacker with write access to the store copies Alice's encrypted_balance over their own row; on next load the backend calls decrypt(…), the value is a structurally valid ciphertext, and the attacker's balance now reads $10,000 — the key was never cracked, only the row was shuffled.
Binding the owner's identity at encrypt closes the hole. The snippets use the client-side envelope encryption in @k9o/kibo; base and decryptBase stand for the provider, key reference and credentials described in Client-side encryption:
// write path — bind the row to its owner
const { envelope } = await encrypt({
...base,
plaintext: new TextEncoder().encode(balance),
encryption_context: [
{ key: 'user_id', value: 'alice_123' },
{ key: 'purpose', value: 'account_balance' },
],
});
The backend always decrypts with the context of the row it is reading — the caller's own identity, taken from runtime truth, never from the stored object:
// read path — Mallory's row, so Mallory's context
const { plaintext } = await decrypt({
...decryptBase,
envelope,
encryption_context: [
{ key: 'user_id', value: 'mallory_999' },
{ key: 'purpose', value: 'account_balance' },
],
});
// the stolen ciphertext was sealed under user_id: 'alice_123'
// → AAD mismatch → AES-256-GCM-SIV tag check fails → hard decrypt failure
Because mallory_999 is not the alice_123 bound at encrypt, the tag verification fails and decryption aborts. The data is protected against substitution even though the attacker never touched the key.
Three rules make the binding sound, and the SDK enforces them:
- Deterministic serialization — the pairs are JCS-canonicalized (keys sorted) before binding, so
{A, B}at encrypt and{B, A}at decrypt produce the same AAD rather than a spurious mismatch. - Re-supplied, never read back — the context is supplied by the caller at decrypt from runtime truth, never read from the envelope. The envelope may store a plaintext copy for audit and so the application knows which values to present, but that copy is never the decrypt input.
- Non-secret by design — because the context is plaintext, the enclave can emit it to the tamper-evident audit ledger, where InfoSec can alert on, for instance, a
purpose: productiondecryption originating outside the expected network.
Composite AAD is injectively framed (length-prefixed, or a single canonical object), never naive concatenation, so two different bindings can never collide into the same byte string.
7. Transmission vectors
Every channel where key material moves is protected by a named mechanism:
| Channel | Protection | Failure mode |
|---|---|---|
| SDK → gateway → vault | HPKE-sealed request; the gateway relays an opaque blob it cannot open | Seal fails; no plaintext transmitted |
| SDK → Kibo enclave | TLS 1.3 + mutual auth + Kibo certificate pinned by the SDK | Handshake rejected; no payload transmitted |
| Kibo / client → customer KMS (BYOK / HYOK) | TLS 1.3 + customer-issued credentials + KMS certificate pinned against the vendor root | Handshake rejected; operation fails closed |
| Re-wrap (CEK_version_N → N+1) | KMS decrypt then encrypt; plaintext CEK never leaves the KMS; the DEK is held only in Kibo's isolated vault memory for the operation | Re-wrap fails; old wrapped DEK valid until next attempt |
| DEK provisioning to an attested client | RATLS — DEK encrypted to the client's attested public key, verified against the vendor root before transmission | Attestation rejected; no plaintext DEK transmitted |
The key-agreement primitive is configuration-driven: it can advance to a hybrid post-quantum KEM without a protocol change, and the HPKE used for the sealed channel takes its KEM from the same configuration — one crypto-agility story across transport and sealing.
The threat each protection answers: a network adversary positioned between two trusted endpoints. Pinning forces the adversary to control the actual endpoint's private key, not merely a CA in the trust chain.
8. Historical-version exposure: re-wrap and tombstone discipline
When a customer rotates their CEK, three sequenced operations close the historical-exposure window:
1. Detect rotation (webhook notification OR safety-sweep scan)
2. Re-wrap (KMS decrypt under vN, encrypt under vN+1: cDK_vN → cDK_vN+1)
3. Tombstone (delete cDK_vN from Kibo's store)
Step 3 is non-optional. If Kibo retains the historical cDK_vN after rotation, anyone who later compromises the old CEK version can decrypt the historical wrapped DEKs — and any retained ciphertext becomes decryptable. The tombstone closes that window. The discipline is enforced as a Kibo BYOK invariant: every wrapped-DEK record maps to an explicit CEK_version_id; on successful re-wrap the prior record is purged and the purge is audit-logged.
9. What this surface does not cover
The cryptographic boundary stops at the wrap/unwrap perimeter. It does not address:
- TEE memory protection itself — see Infrastructure.
- Cross-project DEK isolation — a property of Isolation & Privilege layer 3 combined with wrapped-DEK store partitioning.
- Customer-side CEK custody — the customer owns KMS access control, rotation cadence, and revocation; Kibo's role is to honour rotation events and re-wrap on signal.
The boundary's claims hold to the extent that the infrastructure surface holds (TEE protection) and the identity-aware kernel holds (only authenticated callers reach the encrypt/decrypt API). The surfaces compose; none stands alone.