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
sourceimpl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I>
impl<H: OutputSizeUser, I: HmacImpl<H>> Hkdf<H, I>
sourcepub fn new(salt: Option<&[u8]>, ikm: &[u8]) -> Self
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.
sourcepub fn from_prk(prk: &[u8]) -> Result<Self, InvalidPrkLength>
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.
sourcepub fn extract(salt: Option<&[u8]>, ikm: &[u8]) -> (Output<H>, Self)
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.
Trait Implementations
Auto Trait Implementations
impl<H, I> RefUnwindSafe for Hkdf<H, I> where
H: RefUnwindSafe,
<I as Sealed<H>>::Core: RefUnwindSafe,
impl<H, I> Send for Hkdf<H, I> where
H: Send,
<I as Sealed<H>>::Core: Send,
impl<H, I> Sync for Hkdf<H, I> where
H: Sync,
<I as Sealed<H>>::Core: Sync,
impl<H, I> Unpin for Hkdf<H, I> where
H: Unpin,
<I as Sealed<H>>::Core: Unpin,
impl<H, I> UnwindSafe for Hkdf<H, I> where
H: UnwindSafe,
<I as Sealed<H>>::Core: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more