Skip to main content

decrypt_cose0

Function decrypt_cose0 

Source
pub(crate) fn decrypt_cose0(
    cose_encrypt0: &CoseEncrypt0,
    policy: CoseAlgorithmPolicy,
    cek: &[u8],
) -> Result<Vec<u8>, CryptoError>
Expand description

Authenticates and decrypts a single-recipient COSE [CoseEncrypt0] message.

policy controls whether the protected algorithm is required, must exactly match a typed CEK, or may fall back only for a legacy message. Returns an error for a missing, unsupported, or policy-mismatched algorithm, an invalid CEK length, or failed authentication.