Skip to main content

Hkdf

Struct Hkdf 

Source
pub struct Hkdf<H: Digest> { /* private fields */ }
Expand description

HKDF key schedule state holding one pseudorandom key (PRK).

Implementations§

Source§

impl<H: Digest> Hkdf<H>

Source

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

Extract one pseudorandom key from input keying material.

If salt is None, RFC 5869 uses a digest-length all-zero salt.

Source

pub fn from_prk(prk: &[u8]) -> Option<Self>

Build an HKDF state from a previously extracted PRK.

RFC 5869 defines PRK as one digest-width string.

Source

pub fn prk(&self) -> &[u8]

Return the extracted pseudorandom key.

Source

pub fn expand(&self, info: &[u8], out: &mut [u8]) -> bool

Expand into out with caller-supplied context info.

Returns false if out exceeds 255 * H::OUTPUT_LEN, as required by RFC 5869.

Source

pub fn derive( salt: Option<&[u8]>, ikm: &[u8], info: &[u8], len: usize, ) -> Option<Vec<u8>>

Convenience one-shot HKDF (extract + expand).

Trait Implementations§

Source§

impl<H: Digest> Drop for Hkdf<H>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<H> Freeze for Hkdf<H>

§

impl<H> RefUnwindSafe for Hkdf<H>
where H: RefUnwindSafe,

§

impl<H> Send for Hkdf<H>
where H: Send,

§

impl<H> Sync for Hkdf<H>
where H: Sync,

§

impl<H> Unpin for Hkdf<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for Hkdf<H>

§

impl<H> UnwindSafe for Hkdf<H>
where 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, 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.