pub struct Prk {
algorithm: Algorithm,
mode: PrkMode,
}Expand description
A HKDF PRK (pseudorandom key).
Fields§
§algorithm: Algorithm§mode: PrkModeImplementations§
Source§impl Prk
impl Prk
Sourcepub fn new_less_safe(algorithm: Algorithm, value: &[u8]) -> Self
pub fn new_less_safe(algorithm: Algorithm, value: &[u8]) -> Self
Construct a new Prk directly with the given value.
Usually one can avoid using this. It is useful when the application
intentionally wants to leak the PRK secret, e.g. to implement
SSLKEYLOGFILE functionality.
§Panics
Panics if the given Prk length exceeds the limit
fn try_new_less_safe( algorithm: Algorithm, value: &[u8], ) -> Result<Prk, Unspecified>
Sourcepub fn expand<'a, L: KeyType>(
&'a self,
info: &'a [&'a [u8]],
len: L,
) -> Result<Okm<'a, L>, Unspecified>
pub fn expand<'a, L: KeyType>( &'a self, info: &'a [&'a [u8]], len: L, ) -> Result<Okm<'a, L>, Unspecified>
The HKDF-Expand operation.
The info slices are concatenated with no separator or length prefix to
form the single info octet string of RFC 5869; passing multiple
slices is equivalent to passing their concatenation.
Callers are therefore responsible for unambiguously encoding structured
context. Concatenating variable-length fields directly lets distinct
inputs collide into the same info and derive the same key material
(e.g. &[b"AB", b"CD"] and &[b"ABC", b"D"]); use a fixed-width or
length-prefixed encoding instead. This matches the requirement for AEAD
associated data (crate::aead::Aad).
§Errors
Returns error::Unspecified if:
lenis more than 255 times the digest algorithm’s output length.