-
Notifications
You must be signed in to change notification settings - Fork 37
Description
per wg discussion this is a proposal for how to do HPKE directly.
The approach to allow hpke is to specify a new response_mode by appending .hpke instead of .jwt. This text picks an explicitly series of parameters instead of negotiating them, for simplicity and to align with the other HPKE usage in the ecosystem (Annex C). Encryption is only between the Wallet and the Verifier, and must be credential agnostic so making strong choices seems reasonable (unlike signatures where all parties are involved).
Proposed Text
8.3.1 JWE // Current Encrypted Responses Text
…
8.3.2 HPKE
This section defines how an Authorization Response containing a VP Token (such as when the Response Type value is vp_token or vp_token id_token) can be encrypted at the application level using [HPKE].
The HpkeEncryptedResponse is a JSON Object with the following parameters:
- “enc”: a Base64UrlEncoded string of the bytes of the ‘enc’ output from HPKE
- “cipherText”: A Base64UrlEncoded string of the encrypted, serialized Authorization Response.
The cipherText encryption MUST be performed using the HPKE one-shot API as defined in RFC 9180. The following parameters are used:
- Mode = BASE
- KEM = DHKEM_P256
- KDF = HKDF_SHA256
- AEAD = AES_128_GCM
The Wallet MUST use the following parameters for HPKE Single shot encryption:
- pKR: the Verifier’s public key as received in the jwks
- info: (Two options: cbor-encoded SessionTranscript as specified for mdocs OR hash of concat of strings of same fields)
- pt: JSON-serialized Authorization Response
- aad: empty
The resulting enc and ct are then Base64UrlEncoded and used as the “enc” and “cipherText” parameters in the HpkeEncryptedResponse object.
The Verifier MUST use the following parameters for HPKE Single shot decryption:
- enc: The decoded “enc” parameter in HpkeEncryptedResponse
- ct: The decoded “cipherText” parameter in HpkeEncryptedResponse
- sKR: The private key associated with the Verifier-provided jwks
- info: (SessionTranscript Or hash(concat))
- aad: empty
Text can continue with examples of how to then return this in the body of a direct_post or dc_api response
Notes:
If we wanted to extend to allow agility in choice of algorithms we could do the following:
- Add kid, kdf and aead to the HpkeEncryptedResponse
- Allow multiple jwks, and repeated pairs of supported_algs (kdf, aead).
If we wanted a bit of extra certainty of the .hpke description we could also add a versioning string to the HpkeEncryptedResponse.
The verifier can provide the option of either over DC api by making multiple requests with different response_modes (albeit inefficiently).
Open Questions:
- cbor SessionTranscript vs a Strin concat of equivalent values.
- Do we really need algorithm agility?
- Do we need an encryption identifier in the response?
- should be known from the request, though having it might help with debugging
- Do we need to perform checks on the alg and use of the key vs what is expected by the protocol on the Wallet side?