PKE family

HPKE

Hybrid Public Key Encryption: a KEM, a KDF and an AEAD combined per RFC 9180

unverified 3 variants IETF RFC 9180 (CFRG)

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–2022
  1. Specified in RFC 9180

How it works

  1. Encap: the sender runs the KEM with the recipient's public key to get a shared secret and encapsulated key enc.
  2. KeySchedule: HKDF combines the shared secret, mode, info and optional PSK into an AEAD key, base nonce and exporter secret.
  3. Seal: messages are encrypted with the AEAD using a nonce derived from a sequence counter.
  4. 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

TLS Encrypted Client Hello (ECH)Messaging Layer Security (MLS)Oblivious HTTP and Oblivious DNSEncrypting data to a recipient's public key

Variants in NextSSL

3
AlgorithmTierSizes (bytes)StandardsAPI
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