Crate hkdf

source ·
Expand description

An implementation of HKDF, the HMAC-based Extract-and-Expand Key Derivation Function.

Usage

let ikm = hex::decode("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b").unwrap();
let salt = hex::decode("000102030405060708090a0b0c").unwrap();
let info = hex::decode("f0f1f2f3f4f5f6f7f8f9").unwrap();

let h = Hkdf::<Sha256>::new(Some(&salt[..]), &ikm);
let mut okm = [0u8; 42];
h.expand(&info, &mut okm).unwrap();
println!("OKM is {}", hex::encode(&okm[..]));

Structs

Structure representing the HKDF, capable of HKDF-Expand and HKDF-Extract operations.
Structure representing the streaming context of an HKDF-Extract operation
Structure for InvalidLength, used for output error handling.
Error that is returned when supplied pseudorandom key (PRK) is not long enough.