TAIP-21: Post-Quantum Security for TAP Messaging

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:

  1. Key representation using kty: "AKP" JWKs in W3C DID Documents.
  2. Post-quantum JWE key encapsulation (ML-KEM-768+A256KW and ML-KEM-1024+A256KW) paired with A256CBC-HS512 content encryption in General JWE JSON Serialization.
  3. Post-quantum JWS signing (ML-DSA-87) in JWS JSON Serialization.
  4. 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:

  1. 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.
  2. 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+A256KW and ML-KEM-768+A256KW with A256CBC-HS512 for JWE encryption and decryption.
  • MUST support kty: "AKP" JWK parsing, validation, and serialization.
  • SHOULD support ML-DSA-87 for 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 original alg value for re-serialization and JWK Thumbprint computation.
    • For ML-DSA keys: "ML-DSA-87".
  • 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:
    • For ML-KEM: the 64-byte FIPS-203 seed (d || z).
    • For ML-DSA-87: the 32-byte FIPS-204 seed (xi) per RFC-9964.
    • priv MUST NOT be present in any published DID Document or public JWK.
  • kid, use, key_ops (OPTIONAL): Standard RFC-7517 metadata fields.

3.2 Validation Rules

When parsing an AKP JWK, implementations MUST:

  1. Enforce exact decoded byte lengths for pub and priv (rejecting empty, null, truncated, or oversized values before full base64url decoding).
  2. Validate ML-KEM public keys against the FIPS-203 §7.2 encapsulation key modulus check (every 12-bit coefficient in t_hat MUST satisfy coeff < 3329).
  3. If both pub and priv are present, derive the public key from priv and verify in constant time that it matches pub; reject the key if they differ.
  4. 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 in authentication (and MAY also be referenced in assertionMethod).
  • Post-quantum encryption keys (alg: "ML-KEM-1024+A256KW" or "ML-KEM-768+A256KW") MUST be referenced in keyAgreement.

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 keyAgreement verification method first (e.g., ML-KEM-1024+A256KW before ML-KEM-768+A256KW before X25519).
  • A TAIP-21-capable sender encrypting for a recipient SHOULD select the recipient’s first supported ML-KEM keyAgreement key, falling back to X25519 (ECDH-ES+A256KW) only when the recipient advertises no ML-KEM key.
  • Legacy senders that do not implement TAIP-21 can skip unknown AKP keys and select the classical X25519 key 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 key ENC_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 protected header 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:

  • AlgorithmID is the UTF-8 encoding of the recipient’s JWE alg header value: "ML-KEM-1024+A256KW" (18 bytes) or "ML-KEM-768+A256KW" (17 bytes).
  • PartyUInfo is the raw decoded bytes of the apu header parameter if present, or empty bytes (len = 0) if omitted.
  • PartyVInfo is the raw decoded bytes of the apv header 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):

  1. Generate a fresh 64-byte random CEK and a fresh 16-byte random IV.
  2. Construct the JWE protected header 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 obtain protected.
  3. Encrypt payload with A256CBC-HS512(CEK, iv, ASCII(protected), payload) to obtain (ciphertext, tag).
  4. For each recipient i:
    • If recipient key is ML-KEM (kty: "AKP"):
      1. Validate the recipient’s encapsulation key (pub) per FIPS-203 §7.2.
      2. Run ML-KEM.Encaps(pub) to obtain (ss, kemCt).
      3. Derive KEK = ConcatKDF_SHA256(ss, UTF8(alg), apu, apv).
      4. Compute wrappedKey = A256KW_Wrap(KEK, CEK).
      5. Zeroize ss and KEK from memory.
      6. Append recipient entry:
        {
          "header": {
            "alg": "<ML-KEM-1024+A256KW | ML-KEM-768+A256KW>",
            "kid": "<recipient-kid>",
            "ek": "<base64url(kemCt)>"
          },
          "encrypted_key": "<base64url(wrappedKey)>"
        }
        
    • If recipient key is classical X25519 (kty: "OKP", crv: "X25519"):
      1. Perform standard ECDH-ES+A256KW per RFC-7518 §4.6 and append the recipient entry with header.alg = "ECDH-ES+A256KW", header.kid, header.epk, and encrypted_key.
  5. Zeroize CEK from memory and emit the General JWE JSON object containing protected, recipients, iv, ciphertext, and tag.

5.5 Decryption Procedure

To decrypt a General JWE JSON envelope:

  1. Parse and base64url-decode protected. Verify enc == "A256CBC-HS512".
  2. Locate a recipient entry in recipients[] whose header.kid matches a local decryption key held by the recipient.
  3. Verify header.alg matches the local key’s normalized algorithm (ML-KEM-1024+A256KW or ML-KEM-768+A256KW).
  4. Extract ek from recipient.header (or unprotected/protected headers if absent from per-recipient header), enforce the bounded base64url length, decode kemCt, and verify exact length (1,568 bytes for ML-KEM-1024; 1,088 bytes for ML-KEM-768).
  5. Decode encrypted_key and verify its length is exactly 72 bytes.
  6. Run ss = ML-KEM.Decaps(dk, kemCt). (Per FIPS-203, decapsulation uses implicit rejection and always produces a 32-byte ss in constant time.)
  7. Derive KEK = ConcatKDF_SHA256(ss, UTF8(alg), apu, apv) and zeroize ss.
  8. Unwrap CEK = A256KW_Unwrap(KEK, encrypted_key) and zeroize KEK. If the RFC 3394 integrity check fails, abort with a decryption error.
  9. Decrypt and authenticate ciphertext using A256CBC-HS512(CEK, iv, ASCII(protected), ciphertext, tag) and zeroize CEK.

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 protected header:
    {
      "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 length 0x00):
    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

  1. Parse the JWS (General, Flattened, or Compact serialization) and extract alg, kid, protected, payload, and signature.
  2. Verify alg == "ML-DSA-87" and decode signature, verifying exact length (4,627 bytes).
  3. Resolve kid from the sender’s DID Document (authentication verification methods) and verify the resolved key is an AKP JWK with alg == "ML-DSA-87" and a 2,592-byte pub.
  4. Verify the signature over ASCII(protected) || '.' || ASCII(payload) using FIPS-204 Algorithm 3 / Algorithm 8 (ML-DSA.Verify in 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:

  1. Sign: Sign the plaintext DIDComm v2 message JSON using JWS JSON Serialization (Section 6 for ML-DSA-87, or TAIP-2 for EdDSA / ES256K in the Transitional Confidentiality profile).
  2. Encrypt: Encrypt the serialized JWS bytes as the JWE plaintext using Section 5 (ML-KEM-1024+A256KW or ML-KEM-768+A256KW with A256CBC-HS512), setting "skid" in the JWE protected header to the sender’s signing kid.
  3. Unpack and Verify:
    • Decrypt the outer JWE envelope per Section 5.5.
    • If skid is present in the JWE protected header, the decrypted plaintext MUST be a valid JWS envelope.
    • Resolve the sender’s public key by skid (and verify skid matches the inner JWS kid).
    • Verify the inner JWS signature per Section 6.3 (or TAIP-2 for classical signatures).
    • Verify the DID portion of skid matches the from field 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) or Content-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-87 signatures (~6.2 KB base64url) and ML-KEM-1024 ciphertexts (~2.1 KB base64url) exceed typical URL length limits, Out-of-Band invitations (TAIP-2) using post-quantum envelopes SHOULD use the _oobid URL reference mechanism rather than inline _oob query parameters.

Rationale

  • ML-KEM + A256KW + A256CBC-HS512 over custom KEM-DEM schemes: Aligns with JOSE-PQC-KEM and reuses the exact A256KW + A256CBC-HS512 content encryption layer already deployed by classical ECDH-ES+A256KW DIDComm v2 implementations (such as go-didcomm and tap-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 v2 authcrypt uses ECDH-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 with skid in protected) provides sender authentication, non-repudiation, and confidentiality uniformly across both classical and post-quantum suites, matching the existing go-didcomm and tap-clever architecture.
  • Two profiles (Transitional + Full CNSA 2.0): HNDL attacks threaten confidentiality today, whereas signature forgery requires a live CRQC. Allowing EdDSA + ML-KEM immediately lets institutions deploy quantum-resistant confidentiality without waiting for HSM/KMS upgrades to ML-DSA, while defining ML-DSA-87 + ML-KEM-1024+A256KW gives a clean path to full NSA-CNSA-2.0 compliance.
  • General JWE JSON Serialization: Placing alg, kid, and ek inside recipients[i].header keeps 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+A256KW and ML-KEM-1024+A256KW to 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: 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F
  • KeyData: 00112233445566778899AABBCCDDEEFF000102030405060708090A0B0C0D0E0F
  • Wrapped: 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:

  1. Content encryption downgrade: An ML-KEM JWE envelope whose protected.enc is not "A256CBC-HS512" (e.g., A128GCM or A256GCM).
  2. Malformed AKP JWKs: Missing pub, empty or null priv, wrong byte length for pub or priv, oversized base64url fields, pub failing the FIPS-203 §7.2 modulus check (coeff >= 3329), or pub not matching the key derived from priv.
  3. Tampered KEM ciphertext (ek) or wrapped CEK (encrypted_key): Any single-bit flip in ek or encrypted_key MUST fail decryption cleanly without leaking key material.
  4. Sender/recipient mismatch: Wrong recipient decryption key, mismatched recipient.header.kid, or authcrypt skid not matching the inner JWS kid or message from DID.
  5. Invalid ML-DSA-87 signatures: Wrong signature length (!= 4627), non-canonical hint encoding, out-of-range z norm, or tampered JWS protected/payload.

Security Considerations

  • Constant-Time Implementation & Side Channels: ML-KEM decapsulation, ML-DSA signing, A256KW integrity checks, and pub/priv equality 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, and signature.
  • 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+A256KW recipient 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, and protected.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. Use anoncrypt (omitting skid) 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 AKP verification 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-clever Formally verified CleverLang TAP & DIDComm v2 implementation with CNSA 2.0 (ML-KEM-1024 + ML-DSA-87)

Citation

Please cite this document as:

Pelle Braendgaard, "TAIP-21: Post-Quantum Security for TAP Messaging [DRAFT]," Transaction Authorization Improvement Proposals, no. 21, December 2026. [Online serial]. Available: https://github.com/TransactionAuthorizationProtocol/TAIPs/blob/master/TAIPs/taip-21.md