pub struct Key {
algorithm: Algorithm,
ctx: ManagedPointer<*mut CMAC_CTX>,
}Expand description
A key to use for CMAC signing.
Fields§
§algorithm: Algorithm§ctx: ManagedPointer<*mut CMAC_CTX>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§
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