Key Derivation (KDF) NIST SP 800-56C RFC 5869 §A.1 Verified

HKDF-SHA-256

Extract-and-expand key derivation (RFC 5869) to 42 bytes from input keying material, salt and info.

Open in app Download .ncw

HKDF-SHA-256

Overview & Cryptographic Context

HKDF (HMAC-based Extract-and-Expand Key Derivation Function), defined in RFC 5869, is the foundational key schedule primitive in TLS 1.3, Noise, Signal, and HPKE (RFC 9180). It separates key derivation into two formal stages:

  1. HKDF-Extract: PRK = HMAC-Hash(salt, IKM) concentrates potentially non-uniform entropy (such as a raw Diffie-Hellman shared secret) into a fixed-length pseudorandom key (PRK).
  2. HKDF-Expand: Iteratively computes T(i) = HMAC-Hash(PRK, T(i-1) ‖ info ‖ byte(i)) to stretch PRK into L bytes of domain-separated Output Keying Material (OKM).

This workflow reproduces RFC 5869 Appendix A.1 (Test Case 1) with SHA-256 and output length L = 42 bytes, exercising two HMAC-SHA-256 expansion blocks (⌈ 42 / 32 ⌉ = 2) truncated to 42 bytes.

Pipeline Architecture & Wiring Flow

Workflow Input (IKM, Salt, Info) ──► HKDF Key Derivation (SHA-256, 42 B) ──► Workflow Output (OKM 42B)
  1. Keying Material & Context (Workflow Input): Supplies the 22-byte IKM, 13-byte non-secret Salt, and 10-byte application context Info.
  2. Extract & Expand (HKDF Key Derivation): Configured with hashAlgorithm = "SHA-256" and keyLength = 42.
  3. Derived Key Output (Workflow Output): Collects the 42-byte OKM byte stream.

Nodes & Configuration

NodeNode Role & Key ParametersCount
Workflow InputSupplies IKM, Salt, and Info1
HKDF Key DerivationConfigured with hashAlgorithm = "SHA-256", keyLength = 421
Workflow OutputOutputs 42-byte OKM1

Node reference →

Inputs, Outputs & Test Vector Verification

Verification Source: RFC 5869 §A.1 (Test Case 1, SHA-256, L=42)

Inputs

NameTypeValue (Hex)
IKMbytes (22 B)0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b
Saltbytes (13 B)000102030405060708090a0b0c
Infobytes (10 B)f0f1f2f3f4f5f6f7f8f9

Expected Outputs

NameTypeValue (Hex)
OKMbytes (42 B)3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865