pub struct HMacCtxRef(/* private fields */);
Expand description
A reference to a [HmacCtx
].
Implementations§
Source§impl HMacCtxRef
impl HMacCtxRef
Sourcepub fn reset(&mut self) -> Result<(), ErrorStack>
pub fn reset(&mut self) -> Result<(), ErrorStack>
Clears an existing HMAC_CTX and associated resources.
This will make it suitable for new computations as if it was newly created with HMAC_CTX_new().
This corresponds to HMAC_CTX_reset
.
Sourcepub fn copy(&mut self, src: &HMacCtxRef) -> Result<(), ErrorStack>
pub fn copy(&mut self, src: &HMacCtxRef) -> Result<(), ErrorStack>
This corresponds to HMAC_CTX_copy
.
Sourcepub fn init_ex(
&mut self,
key: Option<&[u8]>,
md: &MdRef,
) -> Result<(), ErrorStack>
pub fn init_ex( &mut self, key: Option<&[u8]>, md: &MdRef, ) -> Result<(), ErrorStack>
This corresponds to HMAC_Init_ex
.
Sourcepub fn md(&self) -> Option<&MdRef>
pub fn md(&self) -> Option<&MdRef>
This corresponds to HMAC_CTX_get_md
.
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Returns the size, in bytes, of the HMAC that will be produced by ctx.
On entry, ctx must have been setup with init_ex
This corresponds to HMAC_size
.
Sourcepub fn hmac_update(&mut self, data: &[u8]) -> Result<(), ErrorStack>
pub fn hmac_update(&mut self, data: &[u8]) -> Result<(), ErrorStack>
Add data bytes to the MAC input.
This corresponds to HMAC_Update
.
Sourcepub fn hmac_final(&mut self, out: &mut [u8]) -> Result<usize, ErrorStack>
pub fn hmac_final(&mut self, out: &mut [u8]) -> Result<usize, ErrorStack>
Place the message authentication code in out.
This corresponds to HMAC_Update
.
Sourcepub fn hmac_final_to_vec(
&mut self,
out: &mut Vec<u8>,
) -> Result<usize, ErrorStack>
pub fn hmac_final_to_vec( &mut self, out: &mut Vec<u8>, ) -> Result<usize, ErrorStack>
Like Self::hmac_final
but appends the signature to a Vec
.
Trait Implementations§
Source§impl AsRef<HMacCtxRef> for HMacCtx
impl AsRef<HMacCtxRef> for HMacCtx
Source§fn as_ref(&self) -> &HMacCtxRef
fn as_ref(&self) -> &HMacCtxRef
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl Borrow<HMacCtxRef> for HMacCtx
impl Borrow<HMacCtxRef> for HMacCtx
Source§fn borrow(&self) -> &HMacCtxRef
fn borrow(&self) -> &HMacCtxRef
Immutably borrows from an owned value. Read more
Source§impl ForeignTypeRef for HMacCtxRef
impl ForeignTypeRef for HMacCtxRef
impl Send for HMacCtxRef
impl Sync for HMacCtxRef
Auto Trait Implementations§
impl !Freeze for HMacCtxRef
impl !RefUnwindSafe for HMacCtxRef
impl Unpin for HMacCtxRef
impl UnwindSafe for HMacCtxRef
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