Composite KDF Mismatch
URI: https://docs.ankatech.co/errors/composite-kdf-mismatch
HTTP Status: 422 Unprocessable Entity
When you see this
A composite (hybrid) JWE was submitted for decryption or re-encryption, and the KDF token its protected header declares in anka_kdf is not the KDF the key material records. The key material is the only source of the KDF; the header is a cross-check. The request is refused before any component ciphertext is decapsulated.
The same type is returned when the protected anka_kdf is absent, is not a string, or is not one of the five published tokens: HKDF-SHA256, HKDF-SHA384, HKDF-SHA512, CatKDF, CasKDF.
Common Causes
- The protected header was edited or rebuilt after encryption, and
anka_kdfno longer names the KDF the key was created with. - The JWE was produced by another composite key, or by a key version that records a different KDF, than the one its
kidandank_kvnow resolve to. - The JWE was assembled by hand or by a tool that omits
anka_kdffrom the protected header, or places it in an unprotected header.
Response Example
{
"type": "https://docs.ankatech.co/errors/composite-kdf-mismatch",
"title": "Composite KDF Mismatch",
"status": 422,
"detail": "Composite JWE for key 'my-hybrid-key' declares anka_kdf 'HKDF-SHA256' but the key material records 'CatKDF'",
"instance": "/api/v3/crypto/decrypt",
"correlationId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"timestamp": 1745120304
}
Content-Type: application/problem+json — the response follows RFC 9457 Problem Details. The detail names the kid and KDF tokens only; a value that is not a token is described, never echoed.
How to Resolve
- Submit the JWE exactly as the API returned it. The protected header is also the AES-GCM additional authenticated data, so it cannot be changed without invalidating the token.
- Check the key's
kdfin its metadata and confirm the JWE was produced by that key and version. - If the JWE comes from another system, re-encrypt the plaintext with the composite key instead of importing the token.
For full schema definitions, examples, and interactive testing, see the Developer Hub Reference.