pub struct Context {
key: Key,
}Expand description
A context for multi-step (Init-Update-Finish) CMAC signing.
Use sign for single-step CMAC signing.
Fields§
§key: KeyImplementations§
Source§impl Context
impl Context
Sourcepub fn update(&mut self, data: &[u8]) -> Result<(), Unspecified>
pub fn update(&mut self, data: &[u8]) -> Result<(), Unspecified>
Updates the CMAC with all the data in data. update may be called
zero or more times until sign is called.
§Errors
error::Unspecified if the CMAC cannot be updated.
Sourcepub fn sign(self) -> Result<Tag, Unspecified>
pub fn sign(self) -> Result<Tag, Unspecified>
Finalizes the CMAC calculation and returns the CMAC value. sign
consumes the context so it cannot be (mis-)used after sign has been
called.
It is generally not safe to implement CMAC verification by comparing
the return value of sign to a tag. Use verify for verification
instead.
§Errors
error::Unspecified if the CMAC calculation cannot be finalized.
§Panics
Panics if the CMAC tag length exceeds the maximum allowed length, indicating memory corruption.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
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