Skip to main content

MacAlgorithmAdapter

Trait MacAlgorithmAdapter 

Source
pub trait MacAlgorithmAdapter {
    const ALG: MacAlgorithm;

    // Required methods
    fn authenticate(
        params: &MacParams<'_>,
        message: &[u8],
    ) -> Result<Vec<u8>, AlgorithmError>;
    fn verify(
        params: &MacParams<'_>,
        message: &[u8],
        tag: &[u8],
    ) -> Result<(), AlgorithmError>;
}
Expand description

Adapter contract for a message authentication code algorithm.

Required Associated Constants§

Source

const ALG: MacAlgorithm

The MAC algorithm selector this adapter implements.

Required Methods§

Source

fn authenticate( params: &MacParams<'_>, message: &[u8], ) -> Result<Vec<u8>, AlgorithmError>

Compute a MAC tag over message.

Source

fn verify( params: &MacParams<'_>, message: &[u8], tag: &[u8], ) -> Result<(), AlgorithmError>

Verify tag over message; failures are returned as typed errors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§