pub struct GenericHkdf<H>where
H: HmacImpl,{ /* 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.
This type is generic over HMAC implementation. Most users should use
Hkdf or SimpleHkdf type aliases.
Implementations§
Source§impl<H> GenericHkdf<H>where
H: HmacImpl,
impl<H> GenericHkdf<H>where
H: HmacImpl,
Sourcepub fn new(salt: Option<&[u8]>, ikm: &[u8]) -> GenericHkdf<H>
pub fn new(salt: Option<&[u8]>, ikm: &[u8]) -> GenericHkdf<H>
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<GenericHkdf<H>, InvalidPrkLength>
pub fn from_prk(prk: &[u8]) -> Result<GenericHkdf<H>, 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],
) -> (Array<u8, <H as OutputSizeUser>::OutputSize>, GenericHkdf<H>)
pub fn extract( salt: Option<&[u8]>, ikm: &[u8], ) -> (Array<u8, <H as OutputSizeUser>::OutputSize>, GenericHkdf<H>)
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§
Source§impl<H> Clone for GenericHkdf<H>
impl<H> Clone for GenericHkdf<H>
Source§fn clone(&self) -> GenericHkdf<H>
fn clone(&self) -> GenericHkdf<H>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more