Struct diem_crypto::hkdf::Hkdf
source · pub struct Hkdf<D>where
D: Update + BlockInput + FixedOutput + Reset + Default + Clone,
D::BlockSize: ArrayLength<u8>,
D::OutputSize: ArrayLength<u8> + IsGreaterOrEqual<U32, Output = True>,{ /* private fields */ }
Expand description
Structure representing the HKDF, capable of HKDF-Extract and HKDF-Expand operations, as defined in RFC 5869.
Implementations§
source§impl<D> Hkdf<D>where
D: Update + BlockInput + FixedOutput + Reset + Default + Clone,
D::BlockSize: ArrayLength<u8> + Clone,
D::OutputSize: ArrayLength<u8> + IsGreaterOrEqual<U32, Output = True>,
impl<D> Hkdf<D>where D: Update + BlockInput + FixedOutput + Reset + Default + Clone, D::BlockSize: ArrayLength<u8> + Clone, D::OutputSize: ArrayLength<u8> + IsGreaterOrEqual<U32, Output = True>,
sourcepub fn extract(salt: Option<&[u8]>, ikm: &[u8]) -> Result<Vec<u8>, HkdfError>
pub fn extract(salt: Option<&[u8]>, ikm: &[u8]) -> Result<Vec<u8>, HkdfError>
The RFC5869 HKDF-Extract operation.
sourcepub fn expand(
prk: &[u8],
info: Option<&[u8]>,
length: usize
) -> Result<Vec<u8>, HkdfError>
pub fn expand( prk: &[u8], info: Option<&[u8]>, length: usize ) -> Result<Vec<u8>, HkdfError>
The RFC5869 HKDF-Expand operation.
sourcepub fn extract_then_expand(
salt: Option<&[u8]>,
ikm: &[u8],
info: Option<&[u8]>,
length: usize
) -> Result<Vec<u8>, HkdfError>
pub fn extract_then_expand( salt: Option<&[u8]>, ikm: &[u8], info: Option<&[u8]>, length: usize ) -> Result<Vec<u8>, HkdfError>
HKDF Extract then Expand operation as a single step.
sourcepub fn extract_then_expand_no_ikm(
salt: Option<&[u8]>,
info: Option<&[u8]>,
length: usize
) -> Result<Vec<u8>, HkdfError>
pub fn extract_then_expand_no_ikm( salt: Option<&[u8]>, info: Option<&[u8]>, length: usize ) -> Result<Vec<u8>, HkdfError>
CAUTION: This is not recommended because it does not take an ikm (seed) as an input and
thus, it is not fully compliant with the HKDF RFC (which always expects a non-zero ikm).
Please use extract_then_expand
instead, unless you know what you are doing.
This api is currently required by the Noise protocol HKDF specs.
HKDF Extract then Expand operation as a single step, but without an ikm input.