Module ring::hkdf[][src]

HMAC-based Extract-and-Expand Key Derivation Function.

HKDF is specified in RFC 5869.

In most situations, it is best to use extract_and_expand to do both the HKDF-Extract and HKDF-Expand as one atomic operation. It is only necessary to use the separate expand and extract functions if a single derived PRK (defined in RFC 5869) is used more than once.

Salts have type hmac::SigningKey instead of &[u8] because they are frequently used for multiple HKDF operations, and it is more efficient to construct the SigningKey once and reuse it. Given a digest algorithm digest_alg and a salt salt: &[u8], the SigningKey should be constructed as hmac::SigningKey::new(digest_alg, salt).

Functions

expand

Fills out with the output of the HKDF-Expand operation for the given inputs.

extract

The HKDF-Extract operation.

extract_and_expand

Fills out with the output of the HKDF Extract-and-Expand operation for the given inputs.