TAIP-21: Post-Quantum Security for TAP Messaging
Table of Contents
TAIP-21: Post-Quantum Security for TAP Messaging
Simple Summary
TAIP-21 extends TAIP-2 messaging with NIST-standardized post-quantum cryptography (ML-KEM for encryption and ML-DSA for signatures) so TAP agents can protect sensitive transaction and Travel Rule data against quantum decryption (“Harvest Now, Decrypt Later”) and future signature forgery while maintaining backwards compatibility with existing DIDComm v2 deployments.
Abstract
TAIP-2 establishes DIDComm v2 over HTTPS with JWS signing (EdDSA / ES256K) and JWE encryption (ECDH-ES+A256KW / ECDH-1PU) as the transport and cryptographic layer for TAP. Those classical elliptic-curve primitives are vulnerable to Cryptographically Relevant Quantum Computers (CRQCs) running Shor’s algorithm. In regulated digital asset transfers, encrypted TAP envelopes routinely carry personally identifiable information (PII) under TAIP-8 and TAIP-10 that must remain confidential for multi-year regulatory retention periods—making them immediate targets for “Harvest Now, Decrypt Later” (HNDL) adversaries.
This TAIP specifies interoperable post-quantum cryptographic profiles for TAP messaging built on FIPS-203 (ML-KEM), FIPS-204 (ML-DSA), RFC-9964 (kty: "AKP" and ML-DSA-87 in JOSE), and JOSE-PQC-KEM (ML-KEM-768+A256KW and ML-KEM-1024+A256KW in JWE). It defines:
- Key representation using
kty: "AKP"JWKs in W3C DID Documents. - Post-quantum JWE key encapsulation (
ML-KEM-768+A256KWandML-KEM-1024+A256KW) paired withA256CBC-HS512content encryption in General JWE JSON Serialization. - Post-quantum JWS signing (
ML-DSA-87) in JWS JSON Serialization. - Sign-then-encrypt authenticated encryption (
authcrypt) supporting both a Transitional Confidentiality Profile (classical signing + ML-KEM encryption) and a Full Post-Quantum (CNSA 2.0) Profile (ML-DSA-87+ML-KEM-1024+A256KW), plus mixed classical and post-quantum multi-recipient envelopes for gradual migration.
Motivation
TAP messages coordinate high-value financial transactions and exchange sensitive customer PII (such as TAIP-10 IVMS101 Travel Rule payloads) between institutions. Two distinct quantum threat timelines affect TAP deployments:
- Immediate confidentiality risk (Harvest Now, Decrypt Later): Adversaries can capture encrypted DIDComm v2 envelopes today (at network transit points, compromised relays, or log archives) and decrypt them once a CRQC becomes available. Because financial compliance data and institutional relationships remain sensitive for 5–10+ years, confidentiality requires post-quantum key encapsulation before quantum computers exist.
- Medium-term authenticity risk and regulatory alignment: Financial institutions and sovereign payment rails increasingly align with post-quantum migration mandates such as NSA-CNSA-2.0 (which specifies ML-KEM-1024, ML-DSA-87, AES-256, and SHA-384/SHA-512) and NIST Category 3/5 transition schedules.
Classical DIDComm v2 specifications rely on ECDH-ES and ECDH-1PU over X25519/P-256, which do not have direct KEM equivalents for ECDH-1PU and cannot accommodate ML-KEM ciphertexts without a standardized JOSE profile. Standardizing this profile in a TAIP ensures wire-level interoperability across TAP SDKs (such as go-didcomm, tap-clever, tap-go, tap-rs, and tap-ts).
Specification
1. Cryptographic Profiles
TAIP-21 defines two deployment profiles over TAIP-2 DIDComm v2 messaging:
| Profile | Signing (JWS alg) |
Key Management (JWE alg) |
Content Encryption (JWE enc) |
NIST Security Category | Primary Use Case |
|---|---|---|---|---|---|
| Transitional Confidentiality | EdDSA (Ed25519) or ES256K |
ML-KEM-768+A256KW or ML-KEM-1024+A256KW |
A256CBC-HS512 |
Cat. 3 or 5 (Confidentiality) | Immediate HNDL protection while retaining existing signing keys and infrastructure |
| Full Post-Quantum (CNSA 2.0) | ML-DSA-87 |
ML-KEM-1024+A256KW |
A256CBC-HS512 |
Cat. 5 (End-to-End) | Full quantum resistance and NSA-CNSA-2.0 alignment |
Implementations claiming conformance to TAIP-21:
- MUST support
ML-KEM-1024+A256KWandML-KEM-768+A256KWwithA256CBC-HS512for JWE encryption and decryption. - MUST support
kty: "AKP"JWK parsing, validation, and serialization. - SHOULD support
ML-DSA-87for JWS signing and verification (REQUIRED for the Full Post-Quantum profile).
2. Parameter Sizes
All key, ciphertext, and signature byte lengths MUST conform strictly to FIPS-203 and FIPS-204:
| Algorithm | Standard | Public Key (pub) |
Private Seed (priv) |
Expanded Private Key | Ciphertext (ek) / Signature |
Shared Secret (ss) |
|---|---|---|---|---|---|---|
ML-KEM-768+A256KW |
FIPS-203 | 1,184 bytes | 64 bytes (d \|\| z) |
2,400 bytes | 1,088 bytes | 32 bytes |
ML-KEM-1024+A256KW |
FIPS-203 | 1,568 bytes | 64 bytes (d \|\| z) |
3,168 bytes | 1,568 bytes | 32 bytes |
ML-DSA-87 |
FIPS-204 | 2,592 bytes | 32 bytes (xi) |
4,896 bytes | 4,627 bytes | N/A |
3. Algorithm Key Pair (AKP) JWK Format
Post-quantum keys MUST be represented as JSON Web Keys using the AKP (Algorithm Key Pair) key type defined in RFC-9964 and JOSE-PQC-KEM.
3.1 Required and Optional Members
kty(REQUIRED): MUST be"AKP".alg(REQUIRED): Algorithm identifier string.- For ML-KEM keys:
"ML-KEM-1024+A256KW"or"ML-KEM-768+A256KW". Implementations SHOULD also accept the short KEM parameter-set names"ML-KEM-1024"and"ML-KEM-768"when parsing JWKs and normalize them to"ML-KEM-1024+A256KW"/"ML-KEM-768+A256KW"for JWE dispatch, while preserving the originalalgvalue for re-serialization and JWK Thumbprint computation. - For ML-DSA keys:
"ML-DSA-87".
- For ML-KEM keys:
pub(REQUIRED for public keys): Base64url-encoded (without padding, per RFC-4648 §5) raw public key bytes of the exact length specified in Section 2.priv(OPTIONAL, private keys only): Base64url-encoded (without padding) private key seed:kid,use,key_ops(OPTIONAL): Standard RFC-7517 metadata fields.
3.2 Validation Rules
When parsing an AKP JWK, implementations MUST:
- Enforce exact decoded byte lengths for
pubandpriv(rejecting empty, null, truncated, or oversized values before full base64url decoding). - Validate ML-KEM public keys against the FIPS-203 §7.2 encapsulation key modulus check (every 12-bit coefficient in
t_hatMUST satisfycoeff < 3329). - If both
pubandprivare present, derive the public key fromprivand verify in constant time that it matchespub; reject the key if they differ. - Reject attempts to mutate
kty,pub,priv, or switch parameter sets on an already-parsed key.
3.3 JWK Thumbprint
Per RFC-9964 §5, the canonical JSON input for computing a RFC-7638 JWK Thumbprint of an AKP key consists of the lexicographically ordered required members alg, kty, and pub with no whitespace:
{"alg":"<alg>","kty":"AKP","pub":"<pub>"}
Where <alg> is the exact alg string present in the JWK.
4. DID Document Representation
Because post-quantum public keys are significantly larger than classical elliptic-curve keys (1,184 to 2,592 bytes), did:web (or other document-backed DID methods) SHOULD be used rather than did:key.
Post-quantum verification methods in W3C DID Documents MUST use type: "JsonWebKey2020" with a publicKeyJwk containing the public AKP JWK:
- Post-quantum signing keys (
alg: "ML-DSA-87") MUST be referenced inauthentication(and MAY also be referenced inassertionMethod). - Post-quantum encryption keys (
alg: "ML-KEM-1024+A256KW"or"ML-KEM-768+A256KW") MUST be referenced inkeyAgreement.
4.1 Example DID Document (Full Post-Quantum)
{
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/jws-2020/v1"
],
"id": "did:web:vasp.example",
"verificationMethod": [
{
"id": "did:web:vasp.example#mldsa87",
"type": "JsonWebKey2020",
"controller": "did:web:vasp.example",
"publicKeyJwk": {
"kty": "AKP",
"alg": "ML-DSA-87",
"kid": "did:web:vasp.example#mldsa87",
"pub": "<base64url-encoded 2592-byte ML-DSA-87 public key>"
}
},
{
"id": "did:web:vasp.example#mlkem1024",
"type": "JsonWebKey2020",
"controller": "did:web:vasp.example",
"publicKeyJwk": {
"kty": "AKP",
"alg": "ML-KEM-1024+A256KW",
"kid": "did:web:vasp.example#mlkem1024",
"pub": "<base64url-encoded 1568-byte ML-KEM-1024 encapsulation key>"
}
}
],
"authentication": [
"did:web:vasp.example#mldsa87"
],
"keyAgreement": [
"did:web:vasp.example#mlkem1024"
],
"service": [
{
"id": "did:web:vasp.example#didcomm",
"type": "DIDCommMessaging",
"serviceEndpoint": "https://vasp.example/didcomm"
}
]
}
4.2 Dual-Stack DID Documents and Key Selection
During migration, an agent MAY list both post-quantum (JsonWebKey2020 with kty: "AKP") and classical (X25519KeyAgreementKey2020 / Ed25519VerificationKey2020) verification methods in its DID Document.
- Recipients SHOULD list their preferred
keyAgreementverification method first (e.g.,ML-KEM-1024+A256KWbeforeML-KEM-768+A256KWbeforeX25519). - A TAIP-21-capable sender encrypting for a recipient SHOULD select the recipient’s first supported
ML-KEMkeyAgreementkey, falling back toX25519(ECDH-ES+A256KW) only when the recipient advertises no ML-KEM key. - Legacy senders that do not implement TAIP-21 can skip unknown
AKPkeys and select the classicalX25519key when present.
5. Post-Quantum Message Encryption (JWE)
Post-quantum encrypted TAP messages MUST use RFC-7516 General JWE JSON Serialization (§7.2.1), even for single-recipient messages. Flattened JWE JSON Serialization and Compact JWE Serialization MUST NOT be emitted for ML-KEM messages (though receivers MAY accept Flattened JWE JSON if all required header parameters are present).
5.1 Content Encryption Algorithm
Post-quantum JWE envelopes MUST use A256CBC-HS512 (RFC-7518 §5.2.5) as the content encryption algorithm (enc):
- Content Encryption Key (CEK): 64 random bytes (32-byte HMAC-SHA-512 key
MAC_KEY+ 32-byte AES-256-CBC keyENC_KEY). - Initialization Vector (
iv): 16 random bytes. - Authentication Tag (
tag): 32 bytes (leftmost 256 bits of HMAC-SHA-512). - Additional Authenticated Data (AAD): ASCII bytes of the base64url-encoded
protectedheader string.
Decrypters MUST verify that enc in the JWE protected header is "A256CBC-HS512" and MUST reject any envelope specifying a different content encryption algorithm (preventing algorithm downgrade attacks).
5.2 Key Derivation Function (Concat KDF)
From the 32-byte ML-KEM shared secret ss, both encrypter and decrypter MUST derive a 256-bit (32-byte) Key Encryption Key (KEK) using the single-step NIST SP 800-56A / RFC-7518 §4.6.2 Concat KDF with SHA-256:
KEK = SHA-256(
0x00000001 || // 4-byte big-endian round counter = 1
ss || // 32-byte ML-KEM shared secret
uint32_be(len(AlgorithmID)) || AlgorithmID ||
uint32_be(len(PartyUInfo)) || PartyUInfo ||
uint32_be(len(PartyVInfo)) || PartyVInfo ||
0x00000100 // 4-byte big-endian keydatalen = 256 bits
)
Where:
AlgorithmIDis the UTF-8 encoding of the recipient’s JWEalgheader value:"ML-KEM-1024+A256KW"(18 bytes) or"ML-KEM-768+A256KW"(17 bytes).PartyUInfois the raw decoded bytes of theapuheader parameter if present, or empty bytes (len = 0) if omitted.PartyVInfois the raw decoded bytes of theapvheader parameter if present, or empty bytes (len = 0) if omitted.
5.3 Key Wrapping (A256KW)
The 64-byte CEK MUST be wrapped with the 32-byte KEK using RFC-3394 AES-256 Key Wrap (A256KW) with the default initial value 0xA6A6A6A6A6A6A6A6, producing a 72-byte encrypted_key (64-byte CEK + 8-byte integrity check block).
On decryption, implementations MUST verify that the decoded encrypted_key is exactly 72 bytes and verify the RFC 3394 integrity check value in constant time before using the unwrapped CEK.
5.4 Encryption Procedure
To encrypt payload for one or more recipients (which MAY be a mix of ML-KEM and classical X25519 recipients):
- Generate a fresh 64-byte random CEK and a fresh 16-byte random IV.
- Construct the JWE
protectedheader JSON object:"typ": "application/didcomm-encrypted+json"(REQUIRED)"enc": "A256CBC-HS512"(REQUIRED)"skid": "<sender-signing-kid>"(REQUIRED for authcrypt; MUST be omitted for anoncrypt) Base64url-encode (without padding) the UTF-8 JSON to obtainprotected.
- Encrypt
payloadwithA256CBC-HS512(CEK, iv, ASCII(protected), payload)to obtain(ciphertext, tag). - For each recipient
i:- If recipient key is ML-KEM (
kty: "AKP"):- Validate the recipient’s encapsulation key (
pub) per FIPS-203 §7.2. - Run
ML-KEM.Encaps(pub)to obtain(ss, kemCt). - Derive
KEK = ConcatKDF_SHA256(ss, UTF8(alg), apu, apv). - Compute
wrappedKey = A256KW_Wrap(KEK, CEK). - Zeroize
ssandKEKfrom memory. - Append recipient entry:
{ "header": { "alg": "<ML-KEM-1024+A256KW | ML-KEM-768+A256KW>", "kid": "<recipient-kid>", "ek": "<base64url(kemCt)>" }, "encrypted_key": "<base64url(wrappedKey)>" }
- Validate the recipient’s encapsulation key (
- If recipient key is classical X25519 (
kty: "OKP",crv: "X25519"):- Perform standard
ECDH-ES+A256KWper RFC-7518 §4.6 and append the recipient entry withheader.alg = "ECDH-ES+A256KW",header.kid,header.epk, andencrypted_key.
- Perform standard
- If recipient key is ML-KEM (
- Zeroize
CEKfrom memory and emit the General JWE JSON object containingprotected,recipients,iv,ciphertext, andtag.
5.5 Decryption Procedure
To decrypt a General JWE JSON envelope:
- Parse and base64url-decode
protected. Verifyenc == "A256CBC-HS512". - Locate a recipient entry in
recipients[]whoseheader.kidmatches a local decryption key held by the recipient. - Verify
header.algmatches the local key’s normalized algorithm (ML-KEM-1024+A256KWorML-KEM-768+A256KW). - Extract
ekfromrecipient.header(or unprotected/protected headers if absent from per-recipient header), enforce the bounded base64url length, decodekemCt, and verify exact length (1,568 bytes for ML-KEM-1024; 1,088 bytes for ML-KEM-768). - Decode
encrypted_keyand verify its length is exactly 72 bytes. - Run
ss = ML-KEM.Decaps(dk, kemCt). (Per FIPS-203, decapsulation uses implicit rejection and always produces a 32-bytessin constant time.) - Derive
KEK = ConcatKDF_SHA256(ss, UTF8(alg), apu, apv)and zeroizess. - Unwrap
CEK = A256KW_Unwrap(KEK, encrypted_key)and zeroizeKEK. If the RFC 3394 integrity check fails, abort with a decryption error. - Decrypt and authenticate
ciphertextusingA256CBC-HS512(CEK, iv, ASCII(protected), ciphertext, tag)and zeroizeCEK.
6. Post-Quantum Message Signing (JWS)
For the Full Post-Quantum (CNSA 2.0) profile, TAP messages MUST be signed using FIPS-204 ML-DSA-87 in Pure ML-DSA mode (empty context string) per RFC-9964 and emitted in JWS JSON Serialization (RFC-7515 §7.2) per TAIP-2.
6.1 Signing Parameters
- JWS
protectedheader:{ "typ": "application/didcomm-signed+json", "alg": "ML-DSA-87", "kid": "<sender-signing-kid>" } - JWS Signing Input:
ASCII(BASE64URL(protected)) || '.' || ASCII(BASE64URL(payload)). - Message representative per FIPS-204 Algorithm 2 / Algorithm 7 (Pure ML-DSA, domain byte
0x00, context length0x00):tr = SHAKE256(pk, 64) mu = SHAKE256(tr || 0x00 || 0x00 || signing_input, 64) - Signing randomness: Hedged signing (fresh 32-byte CSPRNG
rnd) is RECOMMENDED; deterministic signing (rnd = 0x00 * 32) MAY be used in deterministic or formally verified environments. - Output signature: 4,627 raw bytes, base64url-encoded (without padding) into
signature.
6.2 Wire Format
{
"payload": "<base64url(plaintext-didcomm-message)>",
"signatures": [
{
"protected": "<base64url({\"typ\":\"application/didcomm-signed+json\",\"alg\":\"ML-DSA-87\",\"kid\":\"did:web:alice.example#mldsa87\"})>",
"header": {
"kid": "did:web:alice.example#mldsa87"
},
"signature": "<base64url(4627-byte ML-DSA-87 signature)>"
}
]
}
6.3 Verification Procedure
- Parse the JWS (General, Flattened, or Compact serialization) and extract
alg,kid,protected,payload, andsignature. - Verify
alg == "ML-DSA-87"and decodesignature, verifying exact length (4,627 bytes). - Resolve
kidfrom the sender’s DID Document (authenticationverification methods) and verify the resolved key is anAKPJWK withalg == "ML-DSA-87"and a 2,592-bytepub. - Verify the signature over
ASCII(protected) || '.' || ASCII(payload)using FIPS-204 Algorithm 3 / Algorithm 8 (ML-DSA.Verifyin pure mode with empty context).
7. Authenticated Encryption (authcrypt)
Because ML-KEM is an anonymous key-encapsulation mechanism and has no direct equivalent to ECDH-1PU, post-quantum authenticated encryption MUST use sign-then-encrypt:
- Sign: Sign the plaintext DIDComm v2 message JSON using JWS JSON Serialization (Section 6 for
ML-DSA-87, or TAIP-2 forEdDSA/ES256Kin the Transitional Confidentiality profile). - Encrypt: Encrypt the serialized JWS bytes as the JWE plaintext using Section 5 (
ML-KEM-1024+A256KWorML-KEM-768+A256KWwithA256CBC-HS512), setting"skid"in the JWEprotectedheader to the sender’s signingkid. - Unpack and Verify:
- Decrypt the outer JWE envelope per Section 5.5.
- If
skidis present in the JWEprotectedheader, the decrypted plaintext MUST be a valid JWS envelope. - Resolve the sender’s public key by
skid(and verifyskidmatches the inner JWSkid). - Verify the inner JWS signature per Section 6.3 (or TAIP-2 for classical signatures).
- Verify the DID portion of
skidmatches thefromfield of the inner plaintext DIDComm message.
8. Transport and Out-of-Band Considerations
- HTTPS transport requirements from TAIP-2 remain unchanged: POST with
Content-Type: application/didcomm-encrypted+json(encrypted) orContent-Type: application/didcomm-signed+json(signed-only) over TLS 1.3+. - Where TLS 1.3 is terminated by the agent or its gateway, enabling hybrid post-quantum TLS key exchange (e.g.,
X25519MLKEM768) is RECOMMENDED for defense in depth. - Because
ML-DSA-87signatures (~6.2 KB base64url) andML-KEM-1024ciphertexts (~2.1 KB base64url) exceed typical URL length limits, Out-of-Band invitations (TAIP-2) using post-quantum envelopes SHOULD use the_oobidURL reference mechanism rather than inline_oobquery parameters.
Rationale
- ML-KEM +
A256KW+A256CBC-HS512over custom KEM-DEM schemes: Aligns with JOSE-PQC-KEM and reuses the exactA256KW+A256CBC-HS512content encryption layer already deployed by classicalECDH-ES+A256KWDIDComm v2 implementations (such asgo-didcommandtap-clever). This enables a single multi-recipient JWE envelope to simultaneously address classical X25519, ML-KEM-768, and ML-KEM-1024 recipients with a shared CEK. - Sign-then-encrypt for
authcrypt: Standard DIDComm v2authcryptusesECDH-1PU, which relies on static-ephemeral Diffie-Hellman and does not exist for lattice-based KEMs. Sign-then-encrypt (inner JWS wrapped inside outer JWE withskidinprotected) provides sender authentication, non-repudiation, and confidentiality uniformly across both classical and post-quantum suites, matching the existinggo-didcommandtap-cleverarchitecture. - Two profiles (Transitional + Full CNSA 2.0): HNDL attacks threaten confidentiality today, whereas signature forgery requires a live CRQC. Allowing
EdDSA+ML-KEMimmediately lets institutions deploy quantum-resistant confidentiality without waiting for HSM/KMS upgrades to ML-DSA, while definingML-DSA-87+ML-KEM-1024+A256KWgives a clean path to full NSA-CNSA-2.0 compliance. - General JWE JSON Serialization: Placing
alg,kid, andekinsiderecipients[i].headerkeeps the wire format identical between single-recipient and multi-recipient envelopes and cleanly supports heterogeneous recipient key types. - Pure ML-KEM vs. Hybrid KEM: This specification standardizes pure FIPS 203
ML-KEM-768+A256KWandML-KEM-1024+A256KWto match NSA-CNSA-2.0 and current JOSE PQC KEM drafts. Hybrid key agreement algorithms (e.g., X25519 + ML-KEM-768) may be added in a future revision or companion TAIP once IETF JOSE finalizes hybrid KEM identifiers.
Test Cases
1. RFC 3394 A256KW Reference Vector
Implementations MUST pass the RFC-3394 §4.6 256-bit KEK test vector:
KEK:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1FKeyData:00112233445566778899AABBCCDDEEFF000102030405060708090A0B0C0D0E0FWrapped:28C9F404C4B810F4CBCCB35CFB87F8263F5786E2D80ED326CBC7F0E71A99F43BFB988B9B7A02DD21
2. General JWE JSON Envelope Structure (ML-KEM-1024)
Decoded protected header (authcrypt):
{
"typ": "application/didcomm-encrypted+json",
"enc": "A256CBC-HS512",
"skid": "did:web:alice.example#mldsa87"
}
Outer General JWE JSON envelope (single ML-KEM-1024 recipient):
{
"protected": "<base64url(protected-json)>",
"recipients": [
{
"header": {
"alg": "ML-KEM-1024+A256KW",
"kid": "did:web:bob.example#mlkem1024",
"ek": "<base64url(1568-byte ML-KEM-1024 ciphertext)>"
},
"encrypted_key": "<base64url(72-byte A256KW-wrapped CEK)>"
}
],
"iv": "<base64url(16-byte IV)>",
"ciphertext": "<base64url(A256CBC-HS512 ciphertext of inner JWS)>",
"tag": "<base64url(32-byte HMAC-SHA-512 tag)>"
}
3. Mixed Classical and Post-Quantum Multi-Recipient Envelope
A single General JWE JSON envelope MAY include recipients using ECDH-ES+A256KW, ML-KEM-768+A256KW, and ML-KEM-1024+A256KW sharing the same protected, iv, ciphertext, and tag:
{
"protected": "<base64url({\"typ\":\"application/didcomm-encrypted+json\",\"enc\":\"A256CBC-HS512\",\"skid\":\"did:web:alice.example#key-1\"})>",
"recipients": [
{
"header": {
"alg": "ECDH-ES+A256KW",
"kid": "did:web:legacy.example#key-2",
"epk": {
"kty": "OKP",
"crv": "X25519",
"x": "<base64url(32-byte X25519 ephemeral public key)>"
}
},
"encrypted_key": "<base64url(72-byte wrapped CEK)>"
},
{
"header": {
"alg": "ML-KEM-768+A256KW",
"kid": "did:web:vasp-a.example#key-2",
"ek": "<base64url(1088-byte ML-KEM-768 ciphertext)>"
},
"encrypted_key": "<base64url(72-byte wrapped CEK)>"
},
{
"header": {
"alg": "ML-KEM-1024+A256KW",
"kid": "did:web:vasp-b.example#mlkem1024",
"ek": "<base64url(1568-byte ML-KEM-1024 ciphertext)>"
},
"encrypted_key": "<base64url(72-byte wrapped CEK)>"
}
],
"iv": "<base64url(16-byte IV)>",
"ciphertext": "<base64url(ciphertext)>",
"tag": "<base64url(32-byte tag)>"
}
4. Required Negative Test Cases
Conforming implementations MUST reject:
- Content encryption downgrade: An ML-KEM JWE envelope whose
protected.encis not"A256CBC-HS512"(e.g.,A128GCMorA256GCM). - Malformed
AKPJWKs: Missingpub, empty ornullpriv, wrong byte length forpuborpriv, oversized base64url fields,pubfailing the FIPS-203 §7.2 modulus check (coeff >= 3329), orpubnot matching the key derived frompriv. - Tampered KEM ciphertext (
ek) or wrapped CEK (encrypted_key): Any single-bit flip inekorencrypted_keyMUST fail decryption cleanly without leaking key material. - Sender/recipient mismatch: Wrong recipient decryption key, mismatched
recipient.header.kid, or authcryptskidnot matching the inner JWSkidor messagefromDID. - Invalid ML-DSA-87 signatures: Wrong signature length (
!= 4627), non-canonical hint encoding, out-of-rangeznorm, or tampered JWSprotected/payload.
Security Considerations
- Constant-Time Implementation & Side Channels: ML-KEM decapsulation, ML-DSA signing,
A256KWintegrity checks, andpub/privequality checks MUST be implemented in constant time to prevent timing and cache side-channel attacks. - Memory Zeroization: Ephemeral ML-KEM shared secrets (
ss), derived KEKs, CEKs, and ML-KEM/ML-DSA private key material SHOULD be explicitly zeroized immediately after use. - Bounded Decoding & DoS Prevention: Implementations MUST validate base64url encoded lengths against the expected algorithm sizes before allocating or decoding buffers for
pub,priv,ek, andsignature. - Encapsulation Key Validation: Encrypters MUST run the FIPS-203 §7.2 modulus check on recipient encapsulation keys before encapsulating to prevent invalid-key attacks.
- Downgrade Prevention: Enforcing
enc == "A256CBC-HS512"and exact 72-byte wrapped CEK length prevents downgrade attacks against symmetric confidentiality or MAC strength (providing 128-bit quantum security against Grover’s algorithm via AES-256 and SHA-512). - Multi-Recipient Security Caveat: In a mixed classical/post-quantum multi-recipient envelope (Section 5.4), a CRQC capable of breaking an
ECDH-ES+A256KWrecipient entry can recover the shared CEK and decrypt the payload for all recipients in that envelope. Senders requiring strict HNDL protection MUST NOT include classical X25519 recipients in the same envelope as post-quantum recipients. - DID Document Integrity: As in TAIP-2, key authenticity relies on the security of the underlying DID method (e.g., HTTPS/DNSSEC/TLS security for
did:web).
Privacy Considerations
- Long-Term PII Confidentiality: Travel Rule payloads (TAIP-10) and selective disclosure presentations (TAIP-8) encrypted with ML-KEM remain confidential against HNDL adversaries even if captured in transit or archived for compliance.
- Metadata Visibility: Per-recipient
header.kid,header.alg, andprotected.skid(in authcrypt) are not encrypted. An observer can determine whether a message uses classical or post-quantum algorithms and identify recipient key IDs, just as in classical TAIP-2 JWE envelopes. Useanoncrypt(omittingskid) when sender anonymity at the outer envelope layer is required. - Envelope Size: ML-KEM-1024 (
ek~2.1 KB) and ML-DSA-87 (signature~6.2 KB) increase envelope sizes relative to X25519/Ed25519. Implementations and relays SHOULD ensure HTTP body size limits comfortably accommodate multi-recipient post-quantum envelopes (e.g., at least 64 KB).
Backwards Compatibility
This TAIP is purely additive to TAIP-2:
- Existing classical TAP messages (
EdDSA,ES256K,ECDH-ES+A256KW,XC20P) remain completely valid. - Agents can publish dual-stack DID Documents containing both classical and post-quantum
AKPverification methods so upgraded peers automatically negotiate post-quantum encryption while legacy peers continue using classical keys. - No TAP application-layer message schemas (TAIP-3 through TAIP-20) are modified.
References
- TAIP-1 Transaction Authorization Improvement Proposals
- TAIP-2 Messaging
- TAIP-8 Selective Disclosure
- TAIP-10 IVMS101 for Travel Rule
- FIPS-203 Module-Lattice-Based Key-Encapsulation Mechanism Standard (ML-KEM)
- FIPS-204 Module-Lattice-Based Digital Signature Standard (ML-DSA)
- RFC-3394 Advanced Encryption Standard (AES) Key Wrap Algorithm
- RFC-4648 The Base16, Base32, and Base64 Data Encodings
- RFC-7515 JSON Web Signature (JWS)
- RFC-7516 JSON Web Encryption (JWE)
- RFC-7517 JSON Web Key (JWK)
- RFC-7518 JSON Web Algorithms (JWA)
- RFC-7638 JSON Web Key (JWK) Thumbprint
- RFC-9964 Use of ML-DSA in JOSE and COSE (AKP Key Type)
- JOSE-PQC-KEM Post-Quantum Key Encapsulation Mechanisms (PQ KEMs) for JOSE (
draft-ietf-jose-pqc-kem) - NSA-CNSA-2.0 Commercial National Security Algorithm Suite 2.0 (CNSA 2.0)
- DIDComm DIDComm Messaging v2.1 Specification
- go-didcomm Reference Go DIDComm v2 implementation with ML-KEM-768/1024+A256KW
tap-cleverFormally verified CleverLang TAP & DIDComm v2 implementation with CNSA 2.0 (ML-KEM-1024 + ML-DSA-87)