Join our Newsletter — 33% off our NHI Course
Home› Guides› HPKE Guide: How Hybrid Public Key Encryption Underpins…
Guide Data Security

HPKE Guide: How Hybrid Public Key Encryption Underpins ECH, MLS and Oblivious HTTP

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 13 min read
On this page

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.

ComponentIDAlgorithmSource document
KEM0x0010DHKEM(P-256, HKDF-SHA256)RFC 9180
KEM0x0011DHKEM(P-384, HKDF-SHA384)RFC 9180
KEM0x0012DHKEM(P-521, HKDF-SHA512)RFC 9180
KEM0x0020DHKEM(X25519, HKDF-SHA256)RFC 9180
KEM0x0021DHKEM(X448, HKDF-SHA512)RFC 9180
KEM0x0040, 0x0041, 0x0042ML-KEM-512, ML-KEM-768, ML-KEM-1024Internet-Draft (registered)
KEM0x0050, 0x0051MLKEM768-P256, MLKEM1024-P384 hybridsdraft-ietf-hpke-pq
KEM0x647AX-Wing (ML-KEM-768 with X25519)CFRG Internet-Draft (registered)
KDF0x0001, 0x0002, 0x0003HKDF-SHA256, HKDF-SHA384, HKDF-SHA512RFC 9180
KDF0x0010 to 0x0013SHAKE128, SHAKE256, TurboSHAKE128, TurboSHAKE256 (single-stage)draft-ietf-hpke-pq
AEAD0x0001AES-128-GCM (16-byte key, 12-byte nonce)RFC 9180
AEAD0x0002AES-256-GCMRFC 9180
AEAD0x0003ChaCha20Poly1305RFC 9180
AEAD0xFFFFExport-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.

ModeIDWhat it authenticatesStatus in the revisionTypical use
mode_base0x00Nothing about the sender; anyone with the public key can encryptSpecifiedECH, MLS, Oblivious HTTP
mode_psk0x01Sender holds a pre-shared keySpecifiedClosed systems where both sides already share a high-entropy secret
mode_auth0x02Sender holds a KEM private keyValue reserved, not specifiedRare; signatures usually preferred
mode_auth_psk0x03Both a PSK and a KEM private keyValue reserved, not specifiedRare

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.

ProtocolStatusHPKE modeWhat HPKE protectsHow keys and suites are publishedContext binding
Encrypted Client HelloRFC 9849BaseThe inner ClientHello, including the real server nameECHConfig 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 SecurityRFC 9420, Proposed Standard (July 2023)BaseWelcome messages to joiners, path secrets in UpdatePath, external joinsKeyPackage carries an HPKE init key; tree nodes hold HPKE key pairs; the MLS cipher suite fixes the HPKE algorithmsLabels prefixed "MLS 1.0" for each purpose
Oblivious HTTPRFC 9458, Proposed Standard (January 2024)BaseBinary HTTP requests and responses passed through a relayGateway key configuration: 8-bit key ID, KEM ID, public key, KDF and AEAD pairsinfo = "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 tracking enc values 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.

PitfallWhat goes wrongControl
Hand-rolled noncesThe 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 integrityUse the library context API; never derive or set nonces yourself
Ignoring sequence exhaustionRFC 9180 requires a MessageLimitReachedError when the sequence number would overflowTreat the error as fatal and set up a new context
Relying on HPKE for replay protectionHPKE only orders messages inside one context; the export interface gives no replay protectionAdd protocol-level replay defences (unique enc tracking, timestamps)
Reusing derivation material or randomnessRFC 9180 says DeriveKeyPair input keying material must not be reused elsewhere, and Encap randomness must not be reused; weak ephemeral randomness breaks base mode confidentialityUse a vetted CSPRNG; generate fresh keys per KEM
Low-entropy PSKsPassword-derived PSKs fall to offline dictionary attackPSK of at least 32 bytes of entropy, ideally at least the KDF output length
Expecting forward secrecyNo HPKE mode gives forward secrecy if the recipient's private key is compromisedRotate recipient keys on a schedule (ECH and OHTTP configs carry key IDs for this) and keep old keys only briefly
Missing context bindingAn empty or generic info string lets ciphertexts cross between applicationsUse a unique, versioned info or label per purpose, as ECH, MLS and OHTTP do
Skipping key validationInvalid curve points or all-zero X25519 outputs undermine the KEMUse libraries that validate per RFC 9180; check against the RFC test vectors

Rolling out HPKE safely

  1. Inventory: find where HPKE is already in use (ECH on CDNs and browsers, OHTTP relays, MLS messaging) and which libraries implement it.
  2. 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.
  3. Test: validate against the RFC 9180 test vectors and the consuming protocol's interoperability tests before production.
  4. Rotate: schedule recipient key rotation, overlapping old and new key IDs, and log which key ID each request used.
  5. 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 enc values rejected at OHTTP gateways.
  • Suite coverage: share of traffic on approved suites, and later on hybrid post-quantum suites.

Framework mapping

HPKE concernNIST SP 800-53 Rev. 5NIST CSF 2.0ISO/IEC 27001:2022 Annex A
Algorithm and suite selectionSC-13 Cryptographic ProtectionPR.DS-02A.8.24 Use of cryptography
Recipient key generation and rotationSC-12 Cryptographic Key Establishment and ManagementPR.DS-02A.8.24
Protecting messages in transit through relaysSC-8 Transmission Confidentiality and IntegrityPR.DS-02A.8.24
Replay and session bindingSC-23 Session AuthenticityPR.DS-02A.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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.