Skip to main content

kdf_context_info

Function kdf_context_info 

Source
fn kdf_context_info(
    alg: Algorithm,
) -> Result<Vec<u8>, SecretProtectedKeyEnvelopeError>
Expand description

Builds the serialized COSE_KDF_Context used as the HKDF info parameter, as required by the COSE “Direct Key with KDF” construction (https://datatracker.ietf.org/doc/html/rfc9053#name-context-information-structu):

COSE_KDF_Context = [
    AlgorithmID : int / tstr,
    PartyUInfo  : [ identity / nil, nonce / nil, other / nil ],
    PartyVInfo  : [ identity / nil, nonce / nil, other / nil ],
    SuppPubInfo : [ keyDataLength : uint, protected : empty_or_serialized_map ],
]

The context binds the derived key to the content-encryption algorithm (alg) and the requested key length, providing domain separation. PartyUInfo/PartyVInfo are empty and protected is the empty (zero-length) map, since no additional negotiated parameters apply.