HKDF turns a high-entropy secret that may be biased—such as key-exchange output—into uniformly random keying material. Built on HMAC and defined in RFC 5869, it is deterministic and normally derives a limited number of keys rather than generating endless random numbers. section 8.6 section 8.9
Use HKDF in two named stages:
- HKDF-Extract accepts the input secret and an optional public salt, using HMAC to produce a uniformly random secret. Reusing different salts separates usages within the same protocol. section 8.6
- HKDF-Expand accepts the extracted secret, optional info, and a requested length, producing uniformly random output; different info values separate derived outputs. section 8.6
Key-exchange output
When a key exchange produces a high-entropy but biased result, run HKDF-Extract to remove bias, then HKDF-Expand to derive the uniformly random keys required by the protocol. section 8.6
Figure 8.10 HKDF is usually found implemented as a single function call that combines both HKDF-Extract (to extract uniform randomness from an input key) and HKDF-Expand (to generate an arbitrary length output).
Use the combined-flow diagram to see how a typical HKDF call joins Extract and Expand. section 8.6
