Skip to main content

algorithm_from_header

Function algorithm_from_header 

Source
fn algorithm_from_header(
    header: &Header,
    default_algorithm: Option<CoseContentEncryptionAlgorithm>,
) -> Result<CoseContentEncryptionAlgorithm, CryptoError>
Expand description

Recovers the content-encryption algorithm declared in a message’s protected header, falling back to default_algorithm when the header omits one.

Some legacy envelopes (notably early PasswordProtectedKeyEnvelopes) were sealed without declaring the content-encryption algorithm in their protected header. Callers that must decrypt such messages pass the algorithm they expect as default_algorithm; passing None requires the header to declare it.