pub struct Hkdf<Variant, Prk, const PRK_LENGTH: usize>{ /* private fields */ }Expand description
HKDF expander for a specific HkdfVariant.
Implementations§
Source§impl<Variant, Prk, const PRK_LENGTH: usize> Hkdf<Variant, Prk, PRK_LENGTH>
impl<Variant, Prk, const PRK_LENGTH: usize> Hkdf<Variant, Prk, PRK_LENGTH>
Sourcepub fn gen() -> Self
👎Deprecated: use generate() instead
pub fn gen() -> Self
use generate() instead
Randomly generates a new PRK for HKDF expand.
Prefer generate. gen is retained for compatibility
with older Rust editions.
Sourcepub fn extract<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized>(
salt: Option<&Salt>,
ikm: &Ikm,
) -> Self
pub fn extract<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized>( salt: Option<&Salt>, ikm: &Ikm, ) -> Self
Extracts a PRK from input keying material and optional salt.
Sourcepub fn extract_and_expand<const OUTPUT_LENGTH: usize, Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized, Output: NewByteArray<OUTPUT_LENGTH>>(
salt: Option<&Salt>,
ikm: &Ikm,
context: &Context,
) -> Result<Output, Error>
pub fn extract_and_expand<const OUTPUT_LENGTH: usize, Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized, Output: NewByteArray<OUTPUT_LENGTH>>( salt: Option<&Salt>, ikm: &Ikm, context: &Context, ) -> Result<Output, Error>
One-shot HKDF extract-and-expand into a fixed-size output type.
§Errors
Returns an error if OUTPUT_LENGTH is outside the range supported by
the selected HKDF variant.
Sourcepub fn extract_and_expand_to_vec<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized>(
output_len: usize,
salt: Option<&Salt>,
ikm: &Ikm,
context: &Context,
) -> Result<Vec<u8>, Error>
pub fn extract_and_expand_to_vec<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized>( output_len: usize, salt: Option<&Salt>, ikm: &Ikm, context: &Context, ) -> Result<Vec<u8>, Error>
Sourcepub fn extract_and_expand_to_bytes<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized, Output: NewBytes + ResizableBytes>(
output_len: usize,
salt: Option<&Salt>,
ikm: &Ikm,
context: &Context,
) -> Result<Output, Error>
pub fn extract_and_expand_to_bytes<Salt: Bytes + ?Sized, Ikm: Bytes + ?Sized, Context: Bytes + ?Sized, Output: NewBytes + ResizableBytes>( output_len: usize, salt: Option<&Salt>, ikm: &Ikm, context: &Context, ) -> Result<Output, Error>
One-shot HKDF extract-and-expand into a runtime-sized byte container.
§Errors
Returns an error if output_len is outside the range supported by the
selected HKDF variant.
Source§impl<Variant, Prk, const PRK_LENGTH: usize> Hkdf<Variant, Prk, PRK_LENGTH>
impl<Variant, Prk, const PRK_LENGTH: usize> Hkdf<Variant, Prk, PRK_LENGTH>
Sourcepub fn expand<const OUTPUT_LENGTH: usize, Context: Bytes + ?Sized, Output>(
&self,
context: &Context,
) -> Result<Output, Error>where
Output: NewByteArray<OUTPUT_LENGTH>,
pub fn expand<const OUTPUT_LENGTH: usize, Context: Bytes + ?Sized, Output>(
&self,
context: &Context,
) -> Result<Output, Error>where
Output: NewByteArray<OUTPUT_LENGTH>,
Expands this PRK into a fixed-size output type.
§Errors
Returns an error if OUTPUT_LENGTH is outside the range supported by
the selected HKDF variant.
Sourcepub fn expand_to_vec<Context: Bytes + ?Sized>(
&self,
output_len: usize,
context: &Context,
) -> Result<Vec<u8>, Error>
pub fn expand_to_vec<Context: Bytes + ?Sized>( &self, output_len: usize, context: &Context, ) -> Result<Vec<u8>, Error>
Sourcepub fn expand_to_bytes<Context: Bytes + ?Sized, Output: NewBytes + ResizableBytes>(
&self,
output_len: usize,
context: &Context,
) -> Result<Output, Error>
pub fn expand_to_bytes<Context: Bytes + ?Sized, Output: NewBytes + ResizableBytes>( &self, output_len: usize, context: &Context, ) -> Result<Output, Error>
Expands this PRK into a runtime-sized byte container.
§Errors
Returns an error if output_len is outside the range supported by the
selected HKDF variant.
Source§impl<Variant, const PRK_LENGTH: usize> Hkdf<Variant, Variant::Prk, PRK_LENGTH>where
Variant: HkdfVariant<PRK_LENGTH>,
impl<Variant, const PRK_LENGTH: usize> Hkdf<Variant, Variant::Prk, PRK_LENGTH>where
Variant: HkdfVariant<PRK_LENGTH>,
Sourcepub fn generate_with_defaults() -> Self
pub fn generate_with_defaults() -> Self
Randomly generates a new PRK using the default stack-allocated type.
Sourcepub fn gen_with_defaults() -> Self
👎Deprecated: use generate_with_defaults() instead
pub fn gen_with_defaults() -> Self
use generate_with_defaults() instead
Randomly generates a new PRK using the default stack-allocated type.
Prefer generate_with_defaults. This
method is retained for compatibility.