HPKE
Hybrid Public Key Encryption: a KEM, a KDF and an AEAD combined per RFC 9180
Overview
HPKE is a standard framework for encrypting messages to a recipient's public key by combining a key encapsulation mechanism, a key derivation function and an authenticated cipher. It replaces ad hoc ECIES variants and underpins TLS Encrypted Client Hello, MLS and Oblivious HTTP.
The sender runs the KEM against the recipient's public key to obtain a shared secret and an encapsulation. A key schedule built on HKDF derives an AEAD key, a base nonce and an exporter secret from that shared secret plus application-supplied info. The sender can then encrypt one or more messages in sequence, and the recipient decapsulates and derives the same context to decrypt.
RFC 9180 defines four modes: base, PSK (adds a pre-shared key), Auth (authenticates the sender with its own KEM key) and AuthPSK. Each ciphersuite is a triple of KEM, KDF and AEAD identifiers, and the design has a published security analysis. Post-quantum and hybrid KEMs such as ML-KEM can be slotted in as further suites. Three ciphersuites are present: DHKEM(P-256, HKDF-SHA256) with HKDF-SHA256 and AES-128-GCM; DHKEM(X25519, HKDF-SHA256) with HKDF-SHA256 and AES-128-GCM; and the same X25519 suite with ChaCha20-Poly1305.
History
2022–2022Specified in RFC 9180
How it works
- Encap: the sender runs the KEM with the recipient's public key to get a shared secret and encapsulated key enc.
- KeySchedule: HKDF combines the shared secret, mode, info and optional PSK into an AEAD key, base nonce and exporter secret.
- Seal: messages are encrypted with the AEAD using a nonce derived from a sequence counter.
- Open: the recipient decapsulates enc, runs the same key schedule and decrypts.
Security notes
The DHKEM suites present are not post-quantum. HPKE contexts must not be reused across too many messages, and in base mode the sender is not authenticated. NextSSL has not yet verified these suites against the RFC 9180 test vectors.
Typical uses
Variants in NextSSL
3| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| HPKE-P-256-SHA-256-Aes128gcm hpke-p256-sha256-aes128gcm |
unverified | out 0–65536 · pk 65 · sk 32 · ct 81–65617 · ctx 0–1024 | RFC 9180 | root |
| HPKE-X25519-SHA-256-Aes128gcm hpke-x25519-sha256-aes128gcm |
unverified | out 0–65536 · pk 32 · sk 32 · ct 48–65584 · ctx 0–1024 | RFC 9180 | root |
| HPKE-X25519-SHA-256-Chacha20poly1305 hpke-x25519-sha256-chacha20poly1305 |
unverified | out 0–65536 · pk 32 · sk 32 · ct 48–65584 · ctx 0–1024 | RFC 9180 | root |
Frequently asked questions
Which HPKE variants does NextSSL include?
NextSSL registers 3 HPKE variants: hpke-p256-sha256-aes128gcm, hpke-x25519-sha256-aes128gcm, hpke-x25519-sha256-chacha20poly1305.
Families with similar names
Other public-key encryption
All 32Related
Counter-mode AES with a GHASH polynomial MAC; the default AEAD of TLS and IPsec
ChaCha20-Poly1305ARX stream cipher with a one-time Poly1305 MAC; fast and constant-time in software
HKDFHMAC-based extract-and-expand key derivation function (RFC 5869)
ML-KEMNIST's primary post-quantum key encapsulation mechanism, standardised in FIPS 203
ECDH (including X25519 and X448)Elliptic-curve Diffie-Hellman key agreement on NIST curves, Curve25519 and Curve448
ChaChaBernstein's ARX stream cipher; ChaCha20 secures much of today's TLS, SSH and VPN traffic