HMacCtx

Struct HMacCtx 

Source
pub struct HMacCtx(/* private fields */);
Expand description

A context object used to perform MAC operations.

Implementations§

Source§

impl HMacCtx

Source

pub fn new() -> Result<Self, ErrorStack>

Creates a new context.

This corresponds to HMAC_CTX_new.

Methods from Deref<Target = HMacCtxRef>§

Source

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.

Source

pub fn copy(&mut self, src: &HMacCtxRef) -> Result<(), ErrorStack>

This corresponds to HMAC_CTX_copy.

Source

pub fn init_ex( &mut self, key: Option<&[u8]>, md: &MdRef, ) -> Result<(), ErrorStack>

This corresponds to HMAC_Init_ex.

Source

pub fn md(&self) -> Option<&MdRef>

This corresponds to HMAC_CTX_get_md.

Source

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.

Source

pub fn hmac_update(&mut self, data: &[u8]) -> Result<(), ErrorStack>

Add data bytes to the MAC input.

This corresponds to HMAC_Update.

Source

pub fn hmac_final(&mut self, out: &mut [u8]) -> Result<usize, ErrorStack>

Place the message authentication code in out.

This corresponds to HMAC_Update.

Source

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

Source§

fn as_ref(&self) -> &HMacCtxRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Borrow<HMacCtxRef> for HMacCtx

Source§

fn borrow(&self) -> &HMacCtxRef

Immutably borrows from an owned value. Read more
Source§

impl Deref for HMacCtx

Source§

type Target = HMacCtxRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &HMacCtxRef

Dereferences the value.
Source§

impl DerefMut for HMacCtx

Source§

fn deref_mut(&mut self) -> &mut HMacCtxRef

Mutably dereferences the value.
Source§

impl Drop for HMacCtx

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl ForeignType for HMacCtx

Source§

type CType = HMAC_CTX

The raw C type.
Source§

type Ref = HMacCtxRef

The type representing a reference to this type.
Source§

unsafe fn from_ptr(ptr: *mut HMAC_CTX) -> HMacCtx

Constructs an instance of this type from its raw type.
Source§

fn as_ptr(&self) -> *mut HMAC_CTX

Returns a raw pointer to the wrapped value.
Source§

impl Send for HMacCtx

Source§

impl Sync for HMacCtx

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.