1. Introduction
CEF is a self-describing, versioned container for data encrypted at rest. A CEF envelope carries everything a decryptor needs to find the right key and the right algorithms, and nothing it must keep secret. It is designed for multi-tenant storage: every envelope is bound to an application context (tenant, purpose, object, schema version) that is not stored, and decryption under any other context fails.
CEF composes only standardised primitives and published constructions (CCSAX-0001 §3, the Core track rule):
- deterministic CBOR [RFC 8949] for the binary form and base64url [RFC 4648 §5] for the text form;
- AES-256-GCM [NIST SP 800-38D] as AEAD;
- HKDF with SHA-384 [RFC 5869, FIPS 180-4] for key derivation;
- a key commitment derived from the data key with a collision-resistant KDF, following the approach recommended by Albertini et al. [ADGKLS22] and formalised as the UtC / HtE transforms by Bellare and Hoang [BH22] (§6.2);
- X-Wing [XWING] (suite CCSAX-H1) to wrap data keys to public keys.
The security notion CEF targets (key commitment plus context commitment) has not been
formalised or proven for this exact composition. That work is Labs item L2
(labs/L2-committing-context-bound-aead.md).
1.1. Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" 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, as shown here.
Notation:
||is byte-string concatenation;0x00is a single zero byte."text"denotes the UTF-8 bytes of the ASCII string, without terminator.u32be(n)is the 4-byte big-endian encoding ofn.SHA-384(x)is defined in [FIPS 180-4]; output 48 bytes.HKDF(salt, ikm, info, L)is HKDF-Extract followed by HKDF-Expand with SHA-384 [RFC 5869];saltis the UTF-8 encoding of the given label.GCM-Seal(K, N, P, A)returnsC || Twith a 16-byte tagT;GCM-Open(K, N, C || T, A)returnsPor failure [NIST SP 800-38D].- CDDL [RFC 8610] is used for structure; the prose is normative where they differ.
1.2. Terms
- CK (content key material): the 32-byte secret from which the per-envelope encryption key and key commitment are derived. In direct mode CK is the key named by the header; in wrapped mode CK is a fresh random DEK.
- DEK: data-encryption key, 32 random bytes, one per wrapped-mode envelope.
- KEK: key-encryption key (symmetric), e.g. a per-tenant key (CCSAX-0005).
- Recipient key: an X-Wing key pair (suite CCSAX-H1).
- Opener: the party decrypting an envelope.
2. Overview
Envelope = [ h : bstr, ; deterministic CBOR encoding of Header (authenticated as AAD)
w : Wrap / null, ; wrapped-DEK block (authenticated by its own AEAD)
ct: bstr ] ; AES-256-GCM ciphertext || 16-byte tag
Two modes exist; exactly one applies to every envelope:
| Mode | Header has kid/kv |
w |
CK | Rotation |
|---|---|---|---|---|
| direct | yes | null |
the symmetric key (kid, kv) |
re-encrypt |
| wrapped | no | Wrap | random DEK, wrapped to a KEK (CCSAX-S1) or a public key (CCSAX-H1) | rewrap (replace w only) |
Every byte of an envelope is authenticated: h and ct by the data AEAD (with the context), and
w by the wrap AEAD, whose associated data also covers SHA-384(h) and the context. h is
authenticated separately from w so that a DEK can be moved to a new key (rewrap, §7.4) without
touching h or ct. This is a deliberate refinement of "the whole header is authenticated as AAD":
the wrap block is not part of the data AAD, because it must be replaceable.
3. Text form
The text form of an envelope E is:
"ccsax1." || base64url(E)
where base64url is the URL- and filename-safe alphabet of [RFC 4648 §5] without padding.
The prefix is ccsax1. (project mark ccsax, CEF major version 1, separator .). It is
case-sensitive.
A parser of the text form MUST:
- reject input longer than
7 + ceil(4 * MAX_ENVELOPE / 3)characters (§4.5) before decoding; - reject input not starting with exactly
ccsax1.; - reject any character outside
[A-Za-z0-9_-]after the prefix, including=, whitespace and line breaks; - reject a base64url body whose length is congruent to 1 modulo 4;
- reject non-canonical encodings: the unused low-order bits of the final character MUST be zero. Equivalently, re-encoding the decoded bytes MUST reproduce the body exactly.
Consequently every binary envelope has exactly one accepted text form.
4. Binary form
4.1. CBOR profile
The binary form, the header bytes h, and the context encoding (§5) MUST use the following
subset of CBOR [RFC 8949] with the core deterministic encoding requirements of
[RFC 8949 §4.2.1]:
- data items: unsigned integers (major type 0) up to 2^53 − 1, byte strings (2), UTF-8 text
strings (3), arrays (4), maps (5) whose keys are unsigned integers, and the simple value
null(0xf6); - the argument of every head MUST use the shortest possible form (preferred serialization);
- all lengths MUST be definite;
- map keys MUST appear in strictly ascending order of their deterministic encodings (for unsigned integer keys this is ascending numeric order); duplicate keys are therefore impossible;
- the following MUST NOT appear: negative integers, tags (major type 6), floating-point values,
true,false,undefined, other simple values, indefinite-length items, and the break code; - text strings MUST be valid UTF-8 (no ill-formed sequences, overlong forms or surrogates);
- the top-level item MUST span the whole input: trailing bytes are an error.
A decoder MUST reject (not repair) any violation. Encoders MUST produce exactly this encoding.
4.2. Envelope
Envelope = [
h: bstr .size (1..512), ; bytes of Header, §4.3
w: Wrap / null, ; §4.4
ct: bstr ; ciphertext || tag, §6
]
Nesting depth (counting the outer array as 1) MUST NOT exceed 2; h is decoded separately with a
maximum depth of 1.
4.3. Header
Header = {
1 => uint, ; v: CEF format version, MUST be 1
2 => SuiteId, ; suite: data suite, e.g. "CCSAX-S1"
? 3 => KeyId, ; kid: key id (direct mode only)
? 4 => uint, ; kv: key version 0..2^32-1 (direct mode only)
5 => bstr, ; nonce: size fixed by the suite (12 for CCSAX-S1)
6 => bstr, ; kc: key commitment, size fixed by the suite (32 for CCSAX-S1)
}
SuiteId = tstr .regexp "CCSAX-[A-Z][0-9]{1,3}"
KeyId = tstr .regexp "[A-Za-z0-9._:-]{1,64}"
| Key | Name | Type | Constraints |
|---|---|---|---|
| 1 | v |
uint | MUST be 1; other values → version error |
| 2 | suite |
tstr | matches SuiteId; MUST be registered with CEF role data (CCSAX-0004) |
| 3 | kid |
tstr | matches KeyId; present iff kv present |
| 4 | kv |
uint | 0 ≤ kv ≤ 2^32 − 1 |
| 5 | nonce |
bstr | CCSAX-S1: exactly 12 bytes |
| 6 | kc |
bstr | CCSAX-S1: exactly 32 bytes |
Keys 1, 2, 5 and 6 are REQUIRED. The key commitment is REQUIRED for every suite defined in v1; a future suite whose AEAD is natively key-committing MAY define field 6 differently, through a CEP. Unknown keys MUST cause rejection (fail closed). Header keys 7–23 are reserved for future versions of this document; keys ≥ 24 are reserved for the CEF Header Field registry (§11.2).
The encoded header MUST NOT exceed 512 bytes (MAX_HEADER).
4.4. Wrap block
Wrap = {
1 => SuiteId, ; alg: wrap suite ("CCSAX-S1" or "CCSAX-H1" in v1)
2 => KeyId, ; kid: id of the KEK or recipient key
3 => uint, ; kv: its version, 0..2^32-1
? 4 => bstr, ; enc: KEM ciphertext (KEM wrap suites only)
5 => bstr, ; nonce: wrap AEAD nonce, 12 bytes
6 => bstr, ; wdek: GCM-Seal of the 32-byte DEK, 48 bytes
}
| Key | Name | Constraints |
|---|---|---|
| 1 | alg |
registered with CEF role wrap |
| 2 | kid |
matches KeyId |
| 3 | kv |
0 ≤ kv ≤ 2^32 − 1 |
| 4 | enc |
CCSAX-H1: REQUIRED, exactly 1120 bytes. CCSAX-S1: MUST be absent |
| 5 | nonce |
exactly 12 bytes |
| 6 | wdek |
exactly 48 bytes (32-byte DEK + 16-byte tag) |
Unknown keys MUST cause rejection. The deterministic encoding of the Wrap map MUST NOT exceed
4096 bytes (MAX_WRAP).
Wrap header. WrapHeader is the deterministic encoding of the Wrap map with key 6 removed.
It is what the wrap AAD authenticates (§7.1).
Mode rule. Exactly one of the following MUST hold, otherwise the envelope is rejected:
(a) the header contains kid and kv and w is null (direct mode); or (b) the header contains
neither and w is a Wrap map (wrapped mode).
4.5. Size limits
| Name | Value | Applies to |
|---|---|---|
MAX_PLAINTEXT |
16 MiB = 16 777 216 bytes | plaintext; ct length ≤ MAX_PLAINTEXT + 16 |
MAX_HEADER |
512 bytes | h |
MAX_WRAP |
4096 bytes | encoded Wrap map |
MAX_ENVELOPE |
16 MiB + 8 KiB = 16 785 408 bytes | whole binary envelope |
MAX_TEXT |
7 + ceil(4 · MAX_ENVELOPE / 3) characters | text form |
Openers MUST check MAX_ENVELOPE (and MAX_TEXT for text input) before parsing. Applications
MAY impose lower limits. Larger objects SHOULD be split by the application into independently
sealed chunks with distinct object context values; a streaming/chunked mode is out of scope for v1.
These limits are far below the AES-GCM per-invocation maximum of 2^39 − 256 bits [NIST SP 800-38D §5.2.1.1].
5. Application context
The context identifies where a plaintext belongs. It is supplied by the application at seal and open time, is not stored in the envelope, and is bound into both the key derivation (§6.1) and the associated data (§6.4).
Context = {
1 => tstr, ; tenant: 1..128 bytes of UTF-8
2 => tstr, ; purpose: 1..64 bytes matching [a-z0-9][a-z0-9._/-]*
? 3 => tstr, ; object: 1..256 bytes of UTF-8 (row id, file id, ...)
? 4 => uint, ; schema: 0..2^32-1, version of the plaintext's format
}
ctx = deterministic CBOR encoding of Context (§4.1)
ctxDigest = SHA-384(ctx) ; 48 bytes
- An absent optional field is omitted from the map. Absent and present-with-any-value are different contexts.
- Purposes beginning with
ccsax/are reserved for this specification and CCSAX-0005 (e.g.ccsax/kek). Implementations MUST NOT let application callers use them. - Applications SHOULD set
objectwhenever a ciphertext belongs to one record, so that a value copied to another record fails to open. They SHOULD setschemawhen the plaintext format can evolve. - The context is authenticated, not secret. Applications MUST NOT put secrets in it and SHOULD NOT put personal data in it (an opaque id is preferable to an e-mail address).
6. Suite CCSAX-S1: data encryption
6.1. Key derivation and commitment
okm = HKDF(salt = "ccsax/v1/cef/S1",
ikm = CK, ; exactly 32 bytes
info = "ccsax/v1/cef/S1/data-keys" || 0x00 || ctxDigest || nonce,
L = 64)
k_enc = okm[0..32) ; AES-256 key for this envelope
kc = okm[32..64) ; key commitment, stored in header field 6
All fields after the label have fixed lengths (48 and 12 bytes), so info is unambiguous.
6.2. Why this is a key commitment, and what is cited
AES-GCM is not key-committing: an adversary can build one ciphertext that decrypts correctly under
two different keys [ADGKLS22], [LGR21]. CEF follows the generic fix of deriving the encryption key
and a commitment string from the same secret with a collision-resistant KDF, storing the commitment
and checking it before decryption. Albertini et al. [ADGKLS22] describe this family of fixes;
Bellare and Hoang [BH22] formalise it as the UtC transform (a committing PRF F maps
(K, N) to (P, L): P is the published commitment and L the subkey for the underlying AEAD)
and, adding the associated data to the input, the HtE transform for commitment to the context
as well. CEF instantiates F with HKDF-SHA-384 over (CK, ctxDigest, nonce). With the context in
the KDF input this is HtE-shaped; with the header (which contains kc) in the GCM associated data,
the header is authenticated too.
Assumptions (to be stated precisely and proven in Labs L2, not yet done):
- HKDF-SHA-384 with a fixed-length 32-byte IKM behaves as a committing PRF; finding
(CK, ctx, N) ≠ (CK', ctx', N')with equalkcrequires a SHA-384 collision or an HMAC key collision. CK is always exactly 32 bytes, which avoids the known HMAC equivalent-key issue for variable-length keys shorter than the block size. - 256-bit
kcgives at most 128-bit security against generic collision search.
6.3. Nonces and usage limits
nonceMUST be 12 bytes from a cryptographically secure random generator, fresh for every seal.- Direct mode reuses CK across envelopes. For each
(kid, kv)an implementation MUST NOT perform more than 2^32 seal operations, the limit [NIST SP 800-38D §8.3] sets for random 96-bit IVs under one key. Although CEF derives a freshk_encper nonce, a repeated nonce under the same CK and context would repeat(k_enc, nonce), which is catastrophic for GCM; the 2^32 budget keeps that probability below about 2^-33. Implementations MUST track usage durably (or rotate keys long before the budget) and MUST refuse to seal once the budget is exhausted. - Wrapped mode uses a fresh random DEK per envelope, so each
k_encis used once. - Every S1 key wrap (§7.2) counts as one invocation against the KEK's budget.
- Deployments SHOULD rotate long before reaching the budget (CCSAX-0005 §5).
6.4. Associated data and encryption
AAD = "ccsax/v1/cef/aad" || 0x00 || u32be(len(h)) || h || ctxDigest
ct = GCM-Seal(k_enc, nonce, plaintext, AAD) ; ciphertext || 16-byte tag
h is the exact header byte string carried in the envelope.
6.5. Sealing, direct mode
Inputs: plaintext P (≤ MAX_PLAINTEXT), symmetric key K with id kid, version kv, bound to
suite CCSAX-S1 and in status active (CCSAX-0005), context Context.
- Check the suite state allows
seal(CCSAX-0004 §3) and consume one unit ofK's budget. nonce← 12 random bytes. Derive(k_enc, kc)with CK = K (§6.1).h← encode{1: 1, 2: "CCSAX-S1", 3: kid, 4: kv, 5: nonce, 6: kc}.ct← GCM-Seal(k_enc, nonce, P, AAD) (§6.4).- Output
[h, null, ct].
6.6. Sealing, wrapped mode
- Check the suite state allows
sealfor CCSAX-S1 andwrapfor the wrap suite. DEK← 32 random bytes;nonce← 12 random bytes. Derive(k_enc, kc)with CK = DEK.h← encode{1: 1, 2: "CCSAX-S1", 5: nonce, 6: kc}.w← Wrap(DEK, recipient, h, ctxDigest) (§7).ct← GCM-Seal(k_enc, nonce, P, AAD).- Output
[h, w, ct]and erase DEK and k_enc.
7. Wrapped-DEK block
7.1. Common construction
For a wrap suite alg with input keying material ikm (§7.2, §7.3):
hdrDigest = SHA-384(h)
wnonce = 12 random bytes
wrapKey = HKDF(salt = "ccsax/v1/cef/wrap/" || alg,
ikm = ikm,
info = "ccsax/v1/cef/wrap/" || alg || "/key" || 0x00 || hdrDigest || ctxDigest || wnonce,
L = 32)
AAD_w = "ccsax/v1/cef/wrap-aad" || 0x00 || hdrDigest || ctxDigest || SHA-384(WrapHeader)
wdek = GCM-Seal(wrapKey, wnonce, DEK, AAD_w) ; 48 bytes
alg is the ASCII suite id (e.g. CCSAX-H1), so the salt for H1 is "ccsax/v1/cef/wrap/CCSAX-H1".
WrapHeader is defined in §4.4; it includes alg, kid, kv, nonce and (for KEMs) enc.
Binding: the wrap is bound to this envelope's header (hence its data nonce and commitment) and to the context. Moving a wrap block to another envelope, or opening it under another context, fails.
No separate commitment is needed for the wrap: the DEK it yields is checked against the
authenticated header commitment kc (§8 step 7). A wrap that decrypted to a different DEK under a
different key would fail that check except with negligible probability.
7.2. Wrap suite CCSAX-S1 (symmetric KEK)
ikm = the 32-byte KEK (kid, kv); enc MUST be absent. Each S1 wrap consumes one unit of the
KEK's 2^32 budget (§6.3).
7.3. Wrap suite CCSAX-H1 (X-Wing)
Sender, with recipient public key pk (1216 bytes) identified by (kid, kv):
(ss, enc) = X-Wing.Encapsulate(pk) ; [XWING] §"Encapsulation": ss 32 bytes, enc 1120 bytes
ikm = ss
Opener, with X-Wing decapsulation key sk (32 bytes): ss = X-Wing.Decapsulate(sk, enc).
X-Wing is specified in draft-connolly-cfrg-xwing-kem-10. Implementations MUST be validated against
the draft's test vectors. X-Wing provides IND-CCA security if either ML-KEM-768 or X25519 (with the
draft's combiner) is secure; see [XWING] and [XWING-PAPER] for the precise claims. ML-KEM
decapsulation uses implicit rejection, so a modified enc yields an unrelated ss and the wrap
AEAD then fails.
Sender authenticity. Anyone holding pk can create a valid H1-wrapped envelope. H1 provides
confidentiality to the recipient, not authenticity of the sender. Applications that need to know who
wrote an envelope MUST add a signature or MAC outside CEF v1 (e.g. CCSAX-G1, once specified).
7.4. Rewrap
rewrap moves an envelope's DEK to a new KEK, a new key version or a new wrap suite without
changing h or ct:
- Parse and policy-check the envelope as in §8 steps 1–4; it MUST be in wrapped mode.
- Unwrap the DEK (§8 steps 5–6) using the current key and the context.
- Derive
kc'from the DEK (§6.1) and compare it withkcin constant time. On mismatch, abort. - Build a new Wrap for the target key with a fresh
wnonce(§7.1), with suite checked forwrap. - Output
[h, w', ct]. Erase the DEK.
Rewrap requires the context, because the wrap is bound to it. Direct-mode envelopes cannot be rewrapped; they are migrated by re-encryption (CCSAX-0006).
8. Opening (parsing and validation)
Openers MUST perform these steps in this order and stop at the first failure:
- Size. Reject input larger than MAX_ENVELOPE (binary) or MAX_TEXT (text). For text, apply §3.
- CBOR. Decode with the strict profile of §4.1 (depth ≤ 2). The top level MUST be an array of exactly 3 items: bstr, Wrap-or-null, bstr.
- Structure. Decode
h(§4.3) andw(§4.4); reject unknown fields, wrong types and sizes outside the generic bounds; checkv = 1; apply the mode rule. Re-encoding the decoded header MUST reproducehexactly. - Policy and suite parameters. Look up
suitein the registry: unknown → reject; check that its state permitsopen(CCSAX-0004 §3) and that it has CEF roledata. Check the suite's exact sizes (nonce,kc,ct≥ 16 bytes). In wrapped mode, check the same foralgwith useunwrap, rolewrap, and the suite'senc/nonce/wdeksizes. - Key lookup. Resolve
(kid, kv)from the header (direct) or fromw(wrapped). Unknown key → reject. The key MUST be bound to the suite being used (suitein direct mode,algin wrapped mode); otherwise reject (anti-downgrade, CCSAX-0006 §4). - Unwrap (wrapped mode only). For H1, decapsulate. Derive
wrapKeyand GCM-OpenwdekwithAAD_w(§7.1). Failure → reject. The result is CK = DEK. - Commitment. Derive
(k_enc, kc')from CK,ctxDigestandnonce(§6.1). Comparekc'with headerkcin constant time. Mismatch → reject. This happens before any decryption. - AEAD. GCM-Open(k_enc, nonce, ct, AAD). Failure → reject. Implementations MUST NOT release any part of the plaintext before the tag has been verified.
- Return the plaintext, plus metadata: suite, mode, key reference, wrap suite, and
needsMigration= true if any suite involved isdeprecatedor the key used isdecrypt-only.
With a wrong context, a wrapped-mode envelope fails at step 6 and a direct-mode envelope at step 7.
9. Error handling
- Every failure in §8 MUST be fatal for that envelope. There are no warnings and no partial results.
- To untrusted callers, an implementation MUST report every opening failure identically (the
reference implementation uses the message
ccsax: cannot open envelope) and SHOULD avoid observable timing differences beyond those inherent in the step at which processing stopped. This limits partitioning-oracle and padding-oracle style attacks [LGR21]. - To trusted logs, implementations SHOULD record a precise internal reason. The reference implementation's codes are:
| Code | Meaning |
|---|---|
E_INPUT_SIZE |
a size limit (§4.5) was exceeded |
E_TEXT_FORM |
bad prefix, alphabet, padding or non-canonical base64url |
E_CBOR |
not strict deterministic CBOR (§4.1) |
E_SCHEMA |
structure, field set, type or size mismatch (§4.3, §4.4, §8 step 4); mode rule |
E_VERSION |
v ≠ 1 |
E_SUITE_UNKNOWN |
suite or wrap suite not in the registry |
E_SUITE_POLICY |
suite state or CEF role does not permit this use |
E_UNSUPPORTED |
registered but not implemented |
E_KEY_UNKNOWN |
no key for (kid, kv) |
E_KEY_POLICY |
key bound to another suite, wrong key type, or key status forbids the operation |
E_COMMITMENT |
key commitment mismatch |
E_AUTH |
AEAD (data or wrap) authentication failure |
E_NONCE_BUDGET |
(seal side) invocation budget exhausted |
E_ARGUMENT |
(seal side) invalid input from the caller |
Negative test vectors list the reference implementation's code. Other implementations MUST fail on every negative vector but MAY classify the reason differently.
10. Versioning and extensibility
- The format version
vand the text prefixccsax1.change only for incompatible changes to this document. A v1 opener MUST rejectv ≠ 1. - New suites are added through the registry (CCSAX-0004) and a CEP, without changing
v, provided they fit the header and Wrap structures defined here. - New header or wrap fields require a new version of this document or a registry entry (§11.2). v1 openers reject unknown fields, so adding a field is never silently ignored.
11. Registries
These registries are maintained in this repository. Changes require a CEP (spec/CEP-0000-process.md).
Suite state changes to forbidden MAY be fast-tracked with a public advisory.
11.1. CEF Suite registry
Machine-readable in registry/suites.json (schema registry/suites.schema.json), described in
CCSAX-0004. Suites usable in CEF v1:
| Suite | CEF roles | State (0.1.0-draft) |
|---|---|---|
CCSAX-S1 |
data, wrap | active |
CCSAX-H1 |
wrap | active |
CCSAX-H2 |
wrap | experimental (not implemented) |
"active" here is a policy value for decryptors. It does not mean reviewed: every entry is at
maturity specified or below (GOVERNANCE.md promotion ladder).
11.2. CEF Header and Wrap Field registries
| Structure | Key | Name | Reference |
|---|---|---|---|
| Header | 1 | v | this document |
| Header | 2 | suite | this document |
| Header | 3 | kid | this document |
| Header | 4 | kv | this document |
| Header | 5 | nonce | this document |
| Header | 6 | kc | this document |
| Header | 7–23 | reserved (future CEF versions) | this document |
| Header | ≥ 24 | registry, by CEP | — |
| Wrap | 1 | alg | this document |
| Wrap | 2 | kid | this document |
| Wrap | 3 | kv | this document |
| Wrap | 4 | enc | this document |
| Wrap | 5 | nonce | this document |
| Wrap | 6 | wdek | this document |
| Wrap | 7–23 | reserved | this document |
| Context | 1–4 | tenant, purpose, object, schema | this document |
| Context | 5–23 | reserved | this document |
11.3. Label registry
All HKDF salts, info prefixes and AAD prefixes used by CEF are listed in CCSAX-0005 §4. New labels
MUST start with ccsax/v1/ and MUST be registered there.
11.4. Text prefix registry
| Prefix | Meaning |
|---|---|
ccsax1. |
CEF version 1 binary envelope, base64url without padding |
11.5. Media type and CBOR tag
None is registered. Registering a media type (e.g. application/ccsax-cef+cbor) and a CBOR tag
with IANA is an open question for a later version; until then, CEF data MUST NOT be wrapped in a CBOR
tag (step 2 rejects tags).
12. Security considerations
- Status. This composition has not been formally analysed (Labs L2) or externally reviewed.
- What is protected. Confidentiality and integrity of the plaintext; integrity of every header and wrap field; binding to the context; commitment to CK, context and nonce.
- What is not protected. Envelope length (≈ plaintext length + overhead) and metadata in the clear: suite, key ids and versions, wrap suite, whether the envelope is wrapped. Key ids SHOULD be opaque and MUST NOT contain personal data. Applications that need length hiding MUST pad before sealing.
- Replay and rollback. CEF does not prevent an attacker with storage write access from replacing
an envelope with an older valid envelope for the same context. Applications that need freshness
MUST include a version counter in the context (
schemais not meant for this) or keep it elsewhere. Bindingobjectprevents moving ciphertexts between records, not rollback of a record. - Sender authenticity. See §7.3: H1 envelopes can be created by anyone who has the public key. S1 envelopes can be created by anyone who has the KEK.
- Nonce misuse. Correctness depends on a working CSPRNG and on enforcing the budget in §6.3. A nonce repeated under the same CK and context reveals the XOR of the plaintexts and enables tag forgery for that derived key.
- Commitment before decryption. Checking
kcfirst prevents multi-key ("invisible salamander", partitioning oracle) attacks from being mounted through GCM's lack of key commitment [ADGKLS22], [LGR21], [GLR17]. It does not replace the GCM tag check. - Quantum adversaries. AES-256 and SHA-384 are generally considered to retain an adequate security margin against known quantum attacks. CCSAX-H1 adds a post-quantum component (ML-KEM-768) for key wrapping. This is not a claim that the system is secure against all future attacks.
- Side channels. The reference implementation runs X-Wing in JavaScript, which cannot guarantee constant-time execution (impl/ts/DEPENDENCIES.md).
- Key erasure. Implementations SHOULD erase DEKs and derived keys after use; managed runtimes only allow best-effort erasure.
- Crypto-shredding relies on every copy of the KEK being destroyed, including backups (CCSAX-0005 §6).
13. Privacy considerations
CEF never stores the context, but the context is authenticated and may be logged by applications. Contexts and key ids SHOULD use opaque identifiers. The test vectors use fictitious data only.
14. Test vectors
vectors/cef-positive.json and vectors/cef-negative.json are generated deterministically by
impl/ts/scripts/gen-vectors.ts from a public seed. Positive vectors include the keys, context,
context encoding and digest, header bytes, AAD, envelope (hex and text) and plaintext. Negative vectors
cover wrong context, wrong key, tampering of every field class, truncation, trailing data,
non-canonical CBOR, unknown fields, version, unknown/forbidden/experimental suites, mode-rule
violations, wrap transplantation and malformed text forms. An independent implementation SHOULD pass
all of them.
15. References
Normative
- [RFC 2119] S. Bradner, "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC 8174] B. Leiba, "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, May 2017.
- [RFC 8949] C. Bormann, P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, December 2020 (§4.2.1 core deterministic encoding).
- [RFC 8610] H. Birkholz, C. Vigano, C. Bormann, "Concise Data Definition Language (CDDL)", RFC 8610, June 2019.
- [RFC 4648] S. Josefsson, "The Base16, Base32, and Base64 Data Encodings", RFC 4648, October 2006 (§5).
- [RFC 5869] H. Krawczyk, P. Eronen, "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)", RFC 5869, May 2010.
- [NIST SP 800-38D] M. Dworkin, "Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC", NIST SP 800-38D, November 2007.
- [FIPS 197] NIST, "Advanced Encryption Standard (AES)", FIPS 197, 2001 (updated May 2023).
- [FIPS 180-4] NIST, "Secure Hash Standard (SHS)", FIPS 180-4, August 2015.
- [XWING] D. Connolly, P. Schwabe, B. E. Westerbaan, "X-Wing: general-purpose hybrid post-quantum KEM", Internet-Draft draft-connolly-cfrg-xwing-kem-10 (work in progress). Test vectors: draft repository
spec/test-vectors.json, commit 5cb311dc. - [FIPS 203] NIST, "Module-Lattice-Based Key-Encapsulation Mechanism Standard", FIPS 203, August 2024.
- [RFC 7748] A. Langley, M. Hamburg, S. Turner, "Elliptic Curves for Security", RFC 7748, January 2016.
Informative
- [ADGKLS22] A. Albertini, T. Duong, S. Gueron, S. Kölbl, A. Luykx, S. Schmieg, "How to Abuse and Fix Authenticated Encryption Without Key Commitment", 31st USENIX Security Symposium, 2022.
- [BH22] M. Bellare, V. T. Hoang, "Efficient Schemes for Committing Authenticated Encryption", EUROCRYPT 2022, LNCS 13276.
- [LGR21] J. Len, P. Grubbs, T. Ristenpart, "Partitioning Oracle Attacks", 30th USENIX Security Symposium, 2021.
- [GLR17] P. Grubbs, J. Lu, T. Ristenpart, "Message Franking via Committing Authenticated Encryption", CRYPTO 2017.
- [XWING-PAPER] M. Barbosa, D. Connolly, J. D. Duarte, A. Kaiser, P. Schwabe, K. Varner, B. Westerbaan, "X-Wing: The Hybrid KEM You've Been Looking For", IACR Communications in Cryptology, vol. 1, no. 1, 2024.
- [RFC 9180] R. Barnes, K. Bhargavan, B. Lipp, C. Wood, "Hybrid Public Key Encryption", RFC 9180, February 2022 (related design; not used by CEF v1).
The [XWING] authors are taken from the draft source in its repository (current revision); the title and version were checked there on 2026-12-05.