sign_to_buffer

Function sign_to_buffer 

pub fn sign_to_buffer<'out>(
    key: &Key,
    data: &[u8],
    output: &'out mut [u8],
) -> Result<&'out mut [u8], Unspecified>
Available on crate feature crypto only.
Expand description

Calculates the CMAC of data using the key key in one step, writing the result into the provided output buffer.

Use Context to calculate CMACs where the input is in multiple parts.

The output buffer must be at least as large as the algorithm’s tag length (obtainable via key.algorithm().tag_len()). The returned slice will be a sub-slice of output containing exactly the tag bytes.

It is generally not safe to implement CMAC verification by comparing the return value of sign_to_buffer to a tag. Use verify for verification instead.

§Errors

error::Unspecified if the output buffer is too small or if the CMAC calculation fails.