HKDF (HMAC-based Key Derivation Function)
What is HKDF (HMAC-based Key Derivation Function)?
HKDF (HMAC-based Key Derivation Function)An extract-then-expand key derivation function based on HMAC, specified in RFC 5869, designed to turn high-entropy but non-uniform secret material (DH shared secrets, master keys) into multiple cryptographically strong keys.
HKDF (HMAC-based Key Derivation Function), defined by Krawczyk in RFC 5869 (2010), is the default modern KDF for symmetric key derivation from already-high-entropy inputs such as Diffie-Hellman shared secrets, master keys, or pre-shared keys. It is built in two phases. Extract takes input keying material (IKM) and an optional salt and applies HMAC to produce a fixed-length pseudorandom key (PRK). Expand then applies HMAC iteratively, with a counter and an info-context parameter, to derive output keying material of arbitrary length. The info parameter is used to bind derived keys to a context, which makes it safe to derive many independent keys from one PRK without collision. HKDF is the KDF chosen for TLS 1.3, Signal, Noise, WireGuard, JWE, the IETF QUIC handshake, and most modern cryptographic protocols. It is not appropriate for low-entropy inputs such as passwords — use Argon2id, scrypt, or bcrypt for those — and it is not itself a MAC; the underlying HMAC is.
● Examples
- 01
TLS 1.3 derives application and exporter traffic keys from the master secret via HKDF-Expand-Label, with separate info contexts per direction.
- 02
A protocol derives a 32-byte encryption key and a 32-byte MAC key from a single DH shared secret by calling HKDF with `info="enc-key"` and `info="mac-key"`.
● Frequently asked questions
What is HKDF (HMAC-based Key Derivation Function)?
An extract-then-expand key derivation function based on HMAC, specified in RFC 5869, designed to turn high-entropy but non-uniform secret material (DH shared secrets, master keys) into multiple cryptographically strong keys. It belongs to the Cryptography category of cybersecurity.
What does HKDF (HMAC-based Key Derivation Function) mean?
An extract-then-expand key derivation function based on HMAC, specified in RFC 5869, designed to turn high-entropy but non-uniform secret material (DH shared secrets, master keys) into multiple cryptographically strong keys.
How does HKDF (HMAC-based Key Derivation Function) work?
HKDF (HMAC-based Key Derivation Function), defined by Krawczyk in RFC 5869 (2010), is the default modern KDF for symmetric key derivation from already-high-entropy inputs such as Diffie-Hellman shared secrets, master keys, or pre-shared keys. It is built in two phases. Extract takes input keying material (IKM) and an optional salt and applies HMAC to produce a fixed-length pseudorandom key (PRK). Expand then applies HMAC iteratively, with a counter and an info-context parameter, to derive output keying material of arbitrary length. The info parameter is used to bind derived keys to a context, which makes it safe to derive many independent keys from one PRK without collision. HKDF is the KDF chosen for TLS 1.3, Signal, Noise, WireGuard, JWE, the IETF QUIC handshake, and most modern cryptographic protocols. It is not appropriate for low-entropy inputs such as passwords — use Argon2id, scrypt, or bcrypt for those — and it is not itself a MAC; the underlying HMAC is.
How do you defend against HKDF (HMAC-based Key Derivation Function)?
Defences for HKDF (HMAC-based Key Derivation Function) typically combine technical controls and operational practices, as detailed in the full definition above.
What are other names for HKDF (HMAC-based Key Derivation Function)?
Common alternative names include: RFC 5869, HMAC KDF.
● Related terms
- cryptography№ 656
Key Derivation Function (KDF)
A cryptographic function that derives one or more strong cryptographic keys from a secret input such as a password, shared secret or master key.
- cryptography№ 533
HMAC
A keyed Message Authentication Code construction built on top of a cryptographic hash function, defined in RFC 2104 and FIPS 198-1.
- cryptography№ 900
PBKDF2
A password-based key derivation function defined in PKCS #5 / RFC 8018 that applies a pseudorandom function with a configurable iteration count and salt.
- cryptography№ 068
Argon2
A modern memory-hard password hashing function and KDF, winner of the 2015 Password Hashing Competition and specified in RFC 9106.
- network-security№ 1279
TLS (Transport Layer Security)
The IETF-standardized cryptographic protocol that provides confidentiality, integrity, and authentication for traffic between two networked applications.
- cryptography№ 352
Diffie–Hellman Key Exchange
A public-key protocol that lets two parties derive a shared secret over an insecure channel without ever transmitting it, based on the difficulty of the discrete logarithm problem.