CoseMacCipher

Trait CoseMacCipher 

Source
pub trait CoseMacCipher: CoseCipher {
    // Required methods
    fn compute(
        key: &CoseKey,
        target: &[u8],
        unprotected_header: &Header,
        protected_header: &Header,
    ) -> Vec<u8> ;
    fn verify(
        key: &CoseKey,
        tag: &[u8],
        maced_data: &[u8],
        unprotected_header: &Header,
        protected_header: &ProtectedHeader,
    ) -> Result<(), CoseCipherError<Self::Error>>;
}
Expand description

Provides basic operations for generating and verifying MAC tags for COSE structures.

This trait is currently not used by any access token function.

Required Methods§

Source

fn compute( key: &CoseKey, target: &[u8], unprotected_header: &Header, protected_header: &Header, ) -> Vec<u8>

Generates a MAC tag for the given target with the given key and returns it.

Source

fn verify( key: &CoseKey, tag: &[u8], maced_data: &[u8], unprotected_header: &Header, protected_header: &ProtectedHeader, ) -> Result<(), CoseCipherError<Self::Error>>

Verifies the tag of the maced_data with the key.

§Errors

If the tag is invalid or does not belong to the maced_data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§