Trait VerifiableMac

Source
pub trait VerifiableMac {
    // Required methods
    fn mac(&self, mac_shared_secret: &Zeroizing<[u8; 32]>) -> impl Mac;
    fn verify_mac(
        &self,
        mac_shared_secret: &Zeroizing<[u8; 32]>,
        tag: &[u8],
    ) -> Result<(), MacError>;

    // Provided method
    fn finalized_mac(&self, mac_shared_secret: &Zeroizing<[u8; 32]>) -> Vec<u8>  { ... }
}
Expand description

Generates and verifies HMAC tags for key authentication.

Required Methods§

Source

fn mac(&self, mac_shared_secret: &Zeroizing<[u8; 32]>) -> impl Mac

Generate an HMAC instance using the provided shared secret.

Source

fn verify_mac( &self, mac_shared_secret: &Zeroizing<[u8; 32]>, tag: &[u8], ) -> Result<(), MacError>

Verify an HMAC tag against the expected value.

Provided Methods§

Source

fn finalized_mac(&self, mac_shared_secret: &Zeroizing<[u8; 32]>) -> Vec<u8>

Generate a finalized HMAC tag as a byte vector.

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§

Source§

impl<T> VerifiableMac for T
where T: Verifier,