Hybrid Public Key Encryption (HPKE) now sits underneath Encrypted Client Hello, Messaging Layer Security and Oblivious HTTP, yet many engineers deploying those protocols cannot say what it guarantees and what it leaves to them. HPKE is a scheme for encrypting arbitrary-sized messages to a recipient's public key by combining a key encapsulation mechanism (KEM), a key derivation function (KDF) and an authenticated encryption algorithm (AEAD). It was published as RFC 9180 in February 2022 and is being revised on the IETF Standards Track, with post-quantum KEMs following. This guide explains its components, modes and identifiers, how each major protocol uses it, and the implementation mistakes that break it. It is written for cryptography-aware engineers and architects; for the TLS handshake itself, see the How TLS Works Guide. Standards status was checked on the IETF Datatracker, RFC Editor and IANA on 26 November 2026; drafts change, so recheck before relying on draft details.
Key takeaways
- One building block, many protocols. ECH (RFC 9849), MLS (RFC 9420) and Oblivious HTTP (RFC 9458) all use HPKE in base mode, so understanding base mode covers most real deployments.
- A cipher suite is three IDs. Every HPKE configuration is a KEM ID, a KDF ID and an AEAD ID from the IANA HPKE registries, for example 0x0020, 0x0001, 0x0001 for DHKEM(X25519, HKDF-SHA256) with HKDF-SHA256 and AES-128-GCM.
- HPKE is not a full protocol. It provides no replay protection beyond ordering inside one context, no forward secrecy against recipient key compromise, does not hide message length and does not prevent downgrade; the calling protocol must supply these.
- The revision drops the authenticated modes. draft-ietf-hpke-hpke-06, approved as a Proposed Standard and in the RFC Editor queue, obsoletes RFC 9180 when published and reserves but no longer specifies mode_auth and mode_auth_psk.
- Post-quantum KEMs are registered but still in draft. IANA lists ML-KEM, ML-KEM hybrid and X-Wing KEM IDs, while draft-ietf-hpke-pq-05 remains a working group Internet-Draft.
What HPKE is and why it was standardised
Before HPKE, protocols that needed to encrypt to a public key each built their own construction from Diffie-Hellman, a hash and a cipher. These ad hoc schemes (ECIES variants and protocol-specific designs) often lacked a security analysis, used inconsistent encodings and were hard to swap to new algorithms. RFC 9180, produced by the IRTF Crypto Forum Research Group and published as an Informational RFC, defined one analysed, algorithm-agile construction with test vectors so that protocol designers could reuse it.
In outline, the sender runs the KEM against the recipient's public key to get a shared secret and an encapsulated key called enc. A key schedule feeds that secret, the mode and an application-supplied info string through the KDF to produce an AEAD key, a base nonce and an exporter secret. The sender transmits enc with the ciphertext; the recipient decapsulates enc with its private key and derives the same values. Two interfaces are defined: a stateful context API (set up once, then Seal or Open many messages) and a single-shot API that wraps setup and one message. A secret export interface lets protocols derive additional keys from the context rather than encrypting directly.
The revision matters for anyone writing policy that cites HPKE. As shown on the Datatracker on 26 November 2026, draft-ietf-hpke-hpke-06 is in the RFC Editor queue as a Proposed Standard and states that it obsoletes RFC 9180 if approved. Existing deployments remain interoperable: the draft keeps the same base and PSK constructions and says deployments of the authenticated modes can continue as RFC 9180 describes.
KEM, KDF and AEAD components
HPKE is generic over its three primitives. Each has a two-byte identifier in the IANA HPKE registries, and protocols carry these identifiers in their key configurations. The table lists the identifiers defined in RFC 9180 plus the post-quantum entries on the IANA registry as last updated on 10 November 2026.
| Component | ID | Algorithm | Source document |
|---|---|---|---|
| KEM | 0x0010 | DHKEM(P-256, HKDF-SHA256) | RFC 9180 |
| KEM | 0x0011 | DHKEM(P-384, HKDF-SHA384) | RFC 9180 |
| KEM | 0x0012 | DHKEM(P-521, HKDF-SHA512) | RFC 9180 |
| KEM | 0x0020 | DHKEM(X25519, HKDF-SHA256) | RFC 9180 |
| KEM | 0x0021 | DHKEM(X448, HKDF-SHA512) | RFC 9180 |
| KEM | 0x0040, 0x0041, 0x0042 | ML-KEM-512, ML-KEM-768, ML-KEM-1024 | Internet-Draft (registered) |
| KEM | 0x0050, 0x0051 | MLKEM768-P256, MLKEM1024-P384 hybrids | draft-ietf-hpke-pq |
| KEM | 0x647A | X-Wing (ML-KEM-768 with X25519) | CFRG Internet-Draft (registered) |
| KDF | 0x0001, 0x0002, 0x0003 | HKDF-SHA256, HKDF-SHA384, HKDF-SHA512 | RFC 9180 |
| KDF | 0x0010 to 0x0013 | SHAKE128, SHAKE256, TurboSHAKE128, TurboSHAKE256 (single-stage) | draft-ietf-hpke-pq |
| AEAD | 0x0001 | AES-128-GCM (16-byte key, 12-byte nonce) | RFC 9180 |
| AEAD | 0x0002 | AES-256-GCM | RFC 9180 |
| AEAD | 0x0003 | ChaCha20Poly1305 | RFC 9180 |
| AEAD | 0xFFFF | Export-only (no encryption key or nonce derived) | RFC 9180 |
- DHKEM: the classical KEMs are built from Diffie-Hellman. Encapsulation generates an ephemeral key pair, computes DH with the recipient's public key and binds both public keys into the shared secret. RFC 9180 requires public key and DH output validation: partial public key validation for the NIST curves and an all-zero output check for X25519 and X448.
- KDF: HKDF is a two-stage (extract then expand) KDF. The SHAKE-based KDFs from the post-quantum draft are single-stage, which the revised core draft accommodates with one-stage variants of its key schedule.
- AEAD: choice between AES-GCM and ChaCha20Poly1305 follows the usual hardware trade-off; see AES-GCM vs ChaCha20-Poly1305. The export-only ID suits protocols that only use HPKE to agree a secret.
The four modes (base, PSK, auth, auth-PSK)
RFC 9180 defines four modes that differ in what the recipient learns about the sender. The mode identifier is mixed into the key schedule, so a ciphertext produced in one mode cannot be opened in another.
| Mode | ID | What it authenticates | Status in the revision | Typical use |
|---|---|---|---|---|
| mode_base | 0x00 | Nothing about the sender; anyone with the public key can encrypt | Specified | ECH, MLS, Oblivious HTTP |
| mode_psk | 0x01 | Sender holds a pre-shared key | Specified | Closed systems where both sides already share a high-entropy secret |
| mode_auth | 0x02 | Sender holds a KEM private key | Value reserved, not specified | Rare; signatures usually preferred |
| mode_auth_psk | 0x03 | Both a PSK and a KEM private key | Value reserved, not specified | Rare |
Decision guidance: use base mode unless the protocol has a specific reason not to, and get sender authentication from the surrounding protocol (TLS certificates in ECH, signatures in MLS). Use PSK mode only when a PSK of at least 32 bytes of entropy already exists; RFC 9180 says the PSK mechanism is unsuitable for passwords because HKDF does not resist dictionary attacks. Avoid designing new systems on the authenticated modes: RFC 9180 notes they are vulnerable to key-compromise impersonation (if the recipient's private key leaks, an attacker can impersonate senders to that recipient), and the revision no longer specifies them. If you need sender authentication with KCI resistance, RFC 9180 recommends signing the encapsulated key and ciphertext with the sender's signing key.
Where HPKE is used: ECH, MLS, OHTTP
All three major consumers use base mode and bind context through the info string or labels, so a ciphertext for one protocol or purpose cannot be replayed into another.
| Protocol | Status | HPKE mode | What HPKE protects | How keys and suites are published | Context binding |
|---|---|---|---|---|---|
| Encrypted Client Hello | RFC 9849 | Base | The inner ClientHello, including the real server name | ECHConfig with config_id, kem_id, public key and a list of KDF and AEAD pairs, usually from DNS HTTPS records (RFC 9848) | info = "tls ech", a zero byte, then the ECHConfig; outer ClientHello used as AEAD associated data |
| Messaging Layer Security | RFC 9420, Proposed Standard (July 2023) | Base | Welcome messages to joiners, path secrets in UpdatePath, external joins | KeyPackage carries an HPKE init key; tree nodes hold HPKE key pairs; the MLS cipher suite fixes the HPKE algorithms | Labels prefixed "MLS 1.0" for each purpose |
| Oblivious HTTP | RFC 9458, Proposed Standard (January 2024) | Base | Binary HTTP requests and responses passed through a relay | Gateway key configuration: 8-bit key ID, KEM ID, public key, KDF and AEAD pairs | info = "message/bhttp request", a zero byte, then the header; response keys exported under "message/bhttp response" |
- ECH: on HelloRetryRequest the client reuses the same HPKE context, so the sequence number gives the second encryption a fresh nonce; RFC 9849 says this prevents a retry hijack. Deployment and enterprise visibility are covered in the Encrypted Client Hello Guide.
- MLS: the mandatory-to-implement suite is MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 (0x0001), so in practice HPKE runs as DHKEM(X25519) with AES-128-GCM and sender authentication comes from Ed25519 signatures. See the End-to-End Encryption and Messaging Protocols Guide.
- Oblivious HTTP: the response is not encrypted with HPKE Seal; the gateway exports a secret, mixes it with a random response nonce and
enc, and derives a fresh AEAD key and nonce. RFC 9458 warns that the relay can replay requests, so the gateway or target must reject replays or make them harmless, for example by trackingencvalues within a Date-based window.
Post-quantum and hybrid KEM direction
Because the shared secret in classical HPKE comes from elliptic curve Diffie-Hellman, recorded ciphertexts are exposed to a future quantum computer. For ECH that exposes which sites a user visited; for MLS Welcome messages it can expose group secrets. That is the harvest now, decrypt later concern; for a structured assessment see the Harvest Now Decrypt Later Risk Assessment Template.
Status as checked on 26 November 2026:
- draft-ietf-hpke-pq-05: a working group Internet-Draft (July 2026, Standards Track intended) defining pure ML-KEM-512, ML-KEM-768 and ML-KEM-1024 KEMs, hybrid MLKEM768-X25519, MLKEM768-P256 and MLKEM1024-P384 KEMs, and SHAKE and TurboSHAKE single-stage KDFs. It recommends ML-KEM-768 or ML-KEM-1024 over ML-KEM-512.
- IANA registrations: code points already exist (0x0040 to 0x0042 for ML-KEM, 0x0050 and 0x0051 for the NIST-curve hybrids, 0x647A for X-Wing), which lets implementers interoperate before the documents are final. Registered does not mean standardised.
- Other proposals: an individual draft for HQC KEMs in HPKE exists but is not a working group document.
Decision guidance: where the protected data has a long confidentiality life, plan for a hybrid KEM so that security holds if either the classical or the post-quantum component survives. Because HPKE suites are negotiated by ID, the migration is a configuration change in protocols such as ECH and OHTTP that publish lists of supported suites, provided your libraries support the new IDs. MLS ties HPKE algorithms to its own cipher suites, so post-quantum MLS depends on new MLS suites. Background on the algorithms is in the ML-KEM Guide and the parallel TLS work is in the Hybrid Post-Quantum TLS Key Exchange Guide.
Implementation pitfalls
HPKE is easy to call and easy to misuse. The cautions below come from the security considerations of RFC 9180, the revised draft and the consuming RFCs.
| Pitfall | What goes wrong | Control |
|---|---|---|
| Hand-rolled nonces | The per-message nonce is the base nonce XORed with a sequence number; managing nonces outside the context can repeat a nonce and break AEAD confidentiality and integrity | Use the library context API; never derive or set nonces yourself |
| Ignoring sequence exhaustion | RFC 9180 requires a MessageLimitReachedError when the sequence number would overflow | Treat the error as fatal and set up a new context |
| Relying on HPKE for replay protection | HPKE only orders messages inside one context; the export interface gives no replay protection | Add protocol-level replay defences (unique enc tracking, timestamps) |
| Reusing derivation material or randomness | RFC 9180 says DeriveKeyPair input keying material must not be reused elsewhere, and Encap randomness must not be reused; weak ephemeral randomness breaks base mode confidentiality | Use a vetted CSPRNG; generate fresh keys per KEM |
| Low-entropy PSKs | Password-derived PSKs fall to offline dictionary attack | PSK of at least 32 bytes of entropy, ideally at least the KDF output length |
| Expecting forward secrecy | No HPKE mode gives forward secrecy if the recipient's private key is compromised | Rotate recipient keys on a schedule (ECH and OHTTP configs carry key IDs for this) and keep old keys only briefly |
| Missing context binding | An empty or generic info string lets ciphertexts cross between applications | Use a unique, versioned info or label per purpose, as ECH, MLS and OHTTP do |
| Skipping key validation | Invalid curve points or all-zero X25519 outputs undermine the KEM | Use libraries that validate per RFC 9180; check against the RFC test vectors |
Rolling out HPKE safely
- Inventory: find where HPKE is already in use (ECH on CDNs and browsers, OHTTP relays, MLS messaging) and which libraries implement it.
- Fix the suite: pick a KEM, KDF and AEAD triple per use, record it, and publish key configurations with key IDs so rotation does not break clients.
- Test: validate against the RFC 9180 test vectors and the consuming protocol's interoperability tests before production.
- Rotate: schedule recipient key rotation, overlapping old and new key IDs, and log which key ID each request used.
- Roll back: keep the previous key configuration published until clients have moved, so a faulty new suite can be withdrawn without an outage.
Detection and measurement
- Decryption failure rate per key ID: spikes point to stale configs or attacks.
- Key age: days since each recipient key was created, against a rotation target.
- Replay rejections: count of duplicate
encvalues rejected at OHTTP gateways. - Suite coverage: share of traffic on approved suites, and later on hybrid post-quantum suites.
Framework mapping
| HPKE concern | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | ISO/IEC 27001:2022 Annex A |
|---|---|---|---|
| Algorithm and suite selection | SC-13 Cryptographic Protection | PR.DS-02 | A.8.24 Use of cryptography |
| Recipient key generation and rotation | SC-12 Cryptographic Key Establishment and Management | PR.DS-02 | A.8.24 |
| Protecting messages in transit through relays | SC-8 Transmission Confidentiality and Integrity | PR.DS-02 | A.8.24 |
| Replay and session binding | SC-23 Session Authenticity | PR.DS-02 | A.8.24 |
Recipient private keys for ECH and OHTTP are machine credentials held by servers and gateways. Manage them as part of your key management programme; see the Cryptographic Key Management Guide.
Practitioner checklist
- Record every HPKE use with its KEM, KDF and AEAD IDs and the consuming protocol.
- Default to base mode; get sender authentication from signatures or the outer protocol.
- Do not start new designs on mode_auth or mode_auth_psk.
- Use the library context API and treat sequence exhaustion as fatal.
- Add replay protection at the protocol layer, especially for Oblivious HTTP gateways.
- Use unique, versioned info strings or labels for every purpose.
- Rotate recipient keys with overlapping key IDs and log key ID usage.
- Track draft-ietf-hpke-hpke and draft-ietf-hpke-pq and plan hybrid KEM adoption for long-lived data.
- Test implementations against RFC 9180 test vectors.
Standards and references
- IRTF CFRG: RFC 9180 Hybrid Public Key Encryption
- IETF HPKE WG: draft-ietf-hpke-hpke, Hybrid Public Key Encryption
- IETF HPKE WG: draft-ietf-hpke-pq, Post-Quantum and Post-Quantum/Traditional Hybrid Algorithms for HPKE
- IANA: Hybrid Public Key Encryption (HPKE) registries
- IETF: RFC 9849 TLS Encrypted Client Hello
- IETF: RFC 9420 The Messaging Layer Security (MLS) Protocol
- IETF: RFC 9458 Oblivious HTTP
Related NHI Mgmt Group resources: How TLS Works Guide · Encrypted Client Hello Guide · Hybrid Post-Quantum TLS Key Exchange Guide · Elliptic Curve Cryptography · Crypto-Agility vs Post-Quantum Cryptography