Module hkdf

Module hkdf 

Source
Expand description

§HKDF (HMAC-based Key Derivation Function)

This module provides HKDF implementation for key derivation as specified in RFC 5869. HKDF is a simple key derivation function that can be used to derive one or more cryptographically strong secret keys from some source of initial keying material.

§Features

  • RFC 5869 compliant HKDF implementation
  • Two-step process: Extract and Expand
  • Support for arbitrary output lengths
  • Uses HMAC-SHA256 as the underlying hash function

§Example

use crypto_async_rs::hkdf;

let salt = b"random-salt";
let ikm = b"input-key-material";
let info = b"application-info";

// Extract phase - derive a pseudorandom key
let prk = hkdf::extract_sha256(salt, ikm);

// Expand phase - derive multiple keys
let encryption_key = hkdf::expand_sha256(&prk, b"encryption", 32);
let mac_key = hkdf::expand_sha256(&prk, b"mac", 32);

Functions§

expand
expand_sha256
Expand a pseudorandom key into additional pseudorandom keys
extract
Generic extract function for use with different HMAC implementations
extract_sha256
Extract a fixed-length pseudorandom key from input keying material