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. Recommendations for the correct usage of the parameters can be found in the crate root.
Implementations§
Source§impl<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.
Sourcepub fn expand_multi_info(
&self,
info_components: &[&[u8]],
okm: &mut [u8],
) -> Result<(), InvalidLength>
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
.
Trait Implementations§
Auto Trait Implementations§
impl<H, I> Freeze for Hkdf<H, I>where
<I as Sealed<H>>::Core: Freeze,
impl<H, I> RefUnwindSafe for Hkdf<H, I>where
<I as Sealed<H>>::Core: RefUnwindSafe,
H: RefUnwindSafe,
impl<H, I> Send for Hkdf<H, I>
impl<H, I> Sync for Hkdf<H, I>
impl<H, I> Unpin for Hkdf<H, I>
impl<H, I> UnwindSafe for Hkdf<H, I>where
<I as Sealed<H>>::Core: UnwindSafe,
H: UnwindSafe,
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