Skip to content

Hybrid cryptography: belt and braces

Why the transition combines classical and post-quantum algorithms, how hybrid key exchange like X25519MLKEM768 works on the wire, composite signatures, costs, and how to turn it on.

Part 06 of 09Intermediate 6 min read
On this page

The new post-quantum algorithms are well studied, but they are young compared with RSA and elliptic curves, and their implementations are younger still. Meanwhile, the classical algorithms are battle-tested but doomed against a quantum computer. Hybrid cryptography uses both at once, so that an attacker has to break both to win.

This is the approach almost every large deployment has taken so far: every major browser, Cloudflare, Google, AWS, Apple's iMessage (PQ3), Signal (PQXDH) and OpenSSH.

The idea: two locks on one door

Imagine a door with two different locks from two different manufacturers. A burglar who finds a flaw in one brand still faces the other. Hybrid cryptography is the same: combine a classical algorithm (say X25519) with a post-quantum one (ML-KEM-768) so that:

  • If a quantum computer arrives, X25519 falls but ML-KEM still protects you.
  • If ML-KEM (or a particular implementation of it) turns out to be flawed, X25519 still protects you against everyone without a quantum computer.
                 ┌─────────────┐
  X25519 ───────►│             │
  shared secret  │  combine    │──► session keys
                 │  (KDF over  │     secure if EITHER
  ML-KEM-768 ───►│  both)      │     input is secure
  shared secret  └─────────────┘

There are good reasons for this caution. SIKE and Rainbow were both broken during the NIST process. Implementation bugs, side channels and timing leaks have been found in early post-quantum libraries (the "KyberSlash" timing issue in several Kyber implementations in 2024 is a well-known example). Hybrids let us deploy post-quantum protection now without betting everything on code that is only a few years old.

Hybrid key exchange in TLS 1.3: X25519MLKEM768

The most widely deployed hybrid is the TLS 1.3 key-exchange group X25519MLKEM768 (codepoint 0x11EC), specified with its siblings in RFC 10024. Here's how it fits into the handshake:

  Client                                                       Server
  ClientHello
    supported_groups: X25519MLKEM768, X25519, P-256, ...
    key_share: X25519MLKEM768 =
      ML-KEM-768 encapsulation key (1,184 B) ‖ X25519 public key (32 B)
                                                      ──────────► (1,216 B)
                                                     ServerHello
                       key_share: X25519MLKEM768 =
       ML-KEM-768 ciphertext (1,088 B) ‖ X25519 public key (32 B)
                                                      ◄────────── (1,120 B)

  Both sides:  shared_secret = ML-KEM secret (32 B) ‖ X25519 secret (32 B)
               → fed into the normal TLS 1.3 key schedule (HKDF)

A few details worth knowing:

  • Concatenation is enough here. TLS 1.3's key schedule already hashes the shared secret together with the full handshake transcript (which includes both public values), so simply concatenating the two secrets gives a secure combination. Generic hybrid KEMs used outside TLS need a more careful combiner (see X-Wing below).
  • Order matters for names. In X25519MLKEM768, the ML-KEM part comes first on the wire despite the name. Libraries handle this; you only need to know the name.
  • Siblings. SecP256r1MLKEM768 (P-256 + ML-KEM-768) and SecP384r1MLKEM1024 (P-384 + ML-KEM-1024) exist for environments that need NIST curves, such as FIPS-oriented or CNSA 2.0 deployments.
  • Pure ML-KEM groups (MLKEM512, MLKEM768, MLKEM1024) also exist and are supported by OpenSSL 3.5+; CNSA 2.0 ultimately expects ML-KEM-1024 alone. Most public-internet deployments use the hybrid for now.

What it costs

About 2.3 KB of extra handshake data (1,216 + 1,120 bytes versus 32 + 32 for X25519 alone), plus a tiny amount of CPU (ML-KEM is very fast). For most connections that's invisible. The real-world snags have been elsewhere:

  • ClientHello grows past one packet. A ~1.2 KB key share pushes the ClientHello beyond a typical 1,500-byte packet. Some old middleboxes, firewalls and server implementations mishandled a ClientHello split across TCP segments. Chrome and Cloudflare documented these "ossification" issues during rollout; most have been fixed, but an old appliance in your path can still be a problem.
  • HelloRetryRequest. If a client sends only an X25519 key share and the server prefers the hybrid (or vice versa), an extra round trip may occur. Most clients send both a hybrid and a classical key share to avoid this.

How to turn it on

In many stacks it's already on by default:

StackHybrid key exchange by default?
Chrome / Edge 131+, Firefox 132+ (desktop), Safari on iOS 26 / macOS 26Yes (client)
OpenSSL 3.5+ (so nginx, HAProxy, Apache, curl built against it)Yes, X25519MLKEM768 first in the default groups
Node.js 22.20+, 24.x, 26.x (OpenSSL 3.5)Yes, with the default ecdhCurve: 'auto'
Node.js 20 (OpenSSL 3.0)No: upgrade
Go 1.24+ crypto/tlsYes, when CurvePreferences is nil
Java (JDK 27)Yes; earlier JDKs need a provider or configuration
rustls 0.23.27+ with aws-lc-rsYes (prefer-post-quantum is a default feature)
Caddy 2.10+Yes
Cloudflare (edge and origin)Yes
AWS ALB/NLBWith a post-quantum security policy, e.g. ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09

The commonest reason it's not working is an explicit classical list left over from old hardening:

js
// Node.js: this silently disables post-quantum key exchange
tls.createServer({ ecdhCurve: 'P-256:P-384', /* ... */ });

// Fix: delete the option (default 'auto'), or list the hybrid first
tls.createServer({ ecdhCurve: 'X25519MLKEM768:X25519:P-256:P-384', /* ... */ });
nginx
# nginx with OpenSSL 3.5+: an old line like this disables the hybrid
ssl_ecdh_curve prime256v1;
# Fix: remove it, or include the hybrid
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1;

npx -y pqe-cli scan . flags these pinned settings, and npx -y pqe-cli check yourdomain.com tells you what a live endpoint negotiates. You can also check by hand with OpenSSL 3.5+:

bash
openssl s_client -connect example.com:443 -groups X25519MLKEM768 </dev/null 2>&1 \
  | grep -i "group"
# Negotiated TLS1.3 group: X25519MLKEM768

Hybrid key exchange in SSH

OpenSSH has led here. Version 9.0 (2022) made the hybrid sntrup761x25519-sha512 (Streamlined NTRU Prime + X25519) the default. OpenSSH 9.9 added mlkem768x25519-sha256, and 10.0 (April 2025) made it the default. It's specified in RFC 10042. Since 10.1, the client warns when a connection falls back to a non-post-quantum key exchange.

To see what one of your servers offers, run npx -y pqe-cli ssh your.server (it reads the server's algorithm list without logging in); ssh -Q kex lists what your own client supports.

Hybrid KEMs outside protocols: X-Wing and friends

When you encrypt data to someone's public key in your own application (envelope encryption, sealed boxes, HPKE), there's no TLS key schedule to do the combining for you. A naive "hash the two secrets together" can be subtly wrong if it doesn't bind the ciphertexts and public keys.

X-Wing (draft-connolly-cfrg-xwing-kem, still an Internet-Draft) is a carefully analysed hybrid KEM combining X25519 and ML-KEM-768 with a SHA3-256 combiner. Its public key is 1,216 bytes and its ciphertext 1,120 bytes. Libraries such as @noble/post-quantum implement it; since it isn't an RFC yet, treat it as pre-standard. RFC 9980 (post-quantum OpenPGP) defines its own ML-KEM + X25519 combination for email and file encryption.

If you must build your own combiner, the general rule is: derive the key with a KDF over both shared secrets, both ciphertexts and both public keys, plus a fixed label. pqe's node-noble-hybrid-kem guide shows a worked example, and the guidance is to prefer a standardised construction wherever one exists.

Hybrid and composite signatures

Signatures can be hybridised too, but it's messier, because the verifier has to understand both.

  • Composite signatures pack a classical and a post-quantum signature (for example ML-DSA-65 + ECDSA P-256, or ML-DSA-44 + Ed25519) into a single algorithm identifier, with one combined public key and one combined signature. Both must verify. The IETF LAMPS working group's composite ML-DSA work for X.509 and a JOSE equivalent are still drafts; some libraries (OpenSSH's ssh-mldsa44-ed25519, experimental in 10.4 and enabled in 10.6; .NET's experimental CompositeMLDsa) ship specific combinations already.
  • Dual signatures / parallel chains attach two independent signatures, or run two certificate chains, so old verifiers can ignore the part they don't understand. Simpler for compatibility, more bytes.

Signature hybrids are about reducing the risk of a flaw in the new algorithm while authentication isn't yet urgent. Some agencies (notably France's ANSSI and Germany's BSI) recommend hybrids for the transition period; the NSA's CNSA 2.0 instead expects pure post-quantum algorithms for national security systems. Know which regime you're under before you design.

When not to use hybrids

Hybrid is the right default for most of the public internet today. Consider pure post-quantum when:

  • A compliance regime requires it (CNSA 2.0 national security systems), or explicitly prefers it.
  • Size or complexity is critical and you have high confidence in the implementation.

And remember what hybrids don't do: they don't fix weak symmetric crypto, they don't help if the post-quantum part is disabled by a pinned config, and a hybrid signature doesn't help anyone whose verifier only checks the classical half.

Costs and benefits at a glance

Classical onlyHybridPure PQ
Safe against quantum attackerNoYesYes
Safe if PQ algorithm is broken classicallyYesYesNo
Handshake / message sizeSmallest+~2.3 KB (TLS KEX)Slightly smaller than hybrid
Implementation complexityLowestHighestMedium
ComplianceBeing phased out (2030–2035)Widely accepted for transitionRequired for CNSA 2.0 end state

Next: Deadlines and regulations.