Skip to main content

algorithm_from_header

Function algorithm_from_header 

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

Resolves the content-encryption algorithm according to policy.

Some legacy envelopes (notably early PasswordProtectedKeyEnvelopes) were sealed without declaring the content-encryption algorithm in their protected header. Only the legacy-default policy permits a missing protected algorithm. An exact policy rejects a supported but different algorithm before the CEK is converted or used.