pub struct Key { /* private fields */ }Expand description
A key to use for CMAC signing.
Implementations§
Source§impl Key
impl Key
Sourcepub fn generate(algorithm: Algorithm) -> Result<Self, Unspecified>
pub fn generate(algorithm: Algorithm) -> Result<Self, Unspecified>
Generate a CMAC signing key using the given algorithm with a random value.
§Errors
error::Unspecified if random generation or key construction fails.
Sourcepub fn new(algorithm: Algorithm, key_value: &[u8]) -> Result<Self, Unspecified>
pub fn new(algorithm: Algorithm, key_value: &[u8]) -> Result<Self, Unspecified>
Construct a CMAC signing key using the given algorithm and key value.
key_value should be a value generated using a secure random number
generator or derived from a random key by a key derivation function.
§Errors
error::Unspecified if the key length doesn’t match the algorithm or if CMAC context
initialization fails.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more