Struct hkdf::Hkdf

source ·
pub struct Hkdf<H: OutputSizeUser, I: HmacImpl<H> = Hmac<H>> { /* private fields */ }
Expand description

Structure representing the HKDF, capable of HKDF-Expand and HKDF-Extract operations.

Implementations§

source§

impl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I>

source

pub fn new(salt: Option<&[u8]>, ikm: &[u8]) -> Self

Convenience method for extract when the generated pseudorandom key can be ignored and only HKDF-Expand operation is needed. This is the most common constructor.

source

pub fn from_prk(prk: &[u8]) -> Result<Self, InvalidPrkLength>

Create Hkdf from an already cryptographically strong pseudorandom key as per section 3.3 from RFC5869.

source

pub fn extract(salt: Option<&[u8]>, ikm: &[u8]) -> (Output<H>, Self)

The RFC5869 HKDF-Extract operation returning both the generated pseudorandom key and Hkdf struct for expanding.

source

pub fn expand_multi_info( &self, info_components: &[&[u8]], okm: &mut [u8] ) -> Result<(), InvalidLength>

The RFC5869 HKDF-Expand operation. This is equivalent to calling expand with the info argument set equal to the concatenation of all the elements of info_components.

source

pub fn expand(&self, info: &[u8], okm: &mut [u8]) -> Result<(), InvalidLength>

The RFC5869 HKDF-Expand operation

If you don’t have any info to pass, use an empty slice.

Trait Implementations§

source§

impl<H: Clone + OutputSizeUser, I: Clone + HmacImpl<H>> Clone for Hkdf<H, I>
where I::Core: Clone,

source§

fn clone(&self) -> Hkdf<H, I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<H, I> Debug for Hkdf<H, I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<H, I> Freeze for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: Freeze,

§

impl<H, I> RefUnwindSafe for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: RefUnwindSafe, H: RefUnwindSafe,

§

impl<H, I> Send for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: Send, H: Send,

§

impl<H, I> Sync for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: Sync, H: Sync,

§

impl<H, I> Unpin for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: Unpin, H: Unpin,

§

impl<H, I> UnwindSafe for Hkdf<H, I>
where I: Sealed<H>, <I as Sealed<H>>::Core: UnwindSafe, H: UnwindSafe,

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<T> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.