Перейти к основному содержимому
PQC Migration, Hybrid Key Exchange (X25519+ML-KEM) & Experiments
Урок 16 из 16

PQC Migration, Hybrid Key Exchange (X25519+ML-KEM) & Experiments

Plan an enterprise post-quantum migration using cryptographic inventories and Mosca's theorem, deploy hybrid X25519+ML-KEM key exchange in TLS 1.3, and benchmark handshake behaviour using OpenSSL 3.5 and oqs-provider.

Эксперт 30 мин Криптография
Этого урока пока нет на выбранном языке — показана версия на другом языке. Перевод готовится.

Цели обучения

  • Prioritize cryptographic migration targets using Mosca's theorem and a Cryptography Bill of Materials (CBOM)
  • Design crypto-agile architectures that decouple application logic from fixed key and signature sizes
  • Explain how TLS 1.3 hybrid key exchange (X25519MLKEM768) combines classical and post-quantum shared secrets
  • Configure and measure hybrid TLS 1.3 handshakes in a lab using OpenSSL 3.5 or oqs-provider

Рекомендуется заранее: Quantum Threats (Shor, Grover), Lattices & FIPS 203/204/205PKI, сертификаты X.509 и рукопожатие TLS 1.3

#Why this matters

Selecting post-quantum algorithms is only the first step. Real organizations run thousands of microservices, hardware security modules (HSMs), VPN appliances, and third-party SDKs built over decades around fixed assumptions: 2048-bit RSA keys, 32-byte ECDH shares, and single-packet TLS ClientHello messages.

Past migrations from SHA-1 to SHA-256 and TLS 1.0 to TLS 1.3 took years and repeatedly broke brittle middleboxes and custom parsers. Transitioning to FIPS 203, 204, and 205 requires systematic discovery, crypto-agile engineering, and controlled lab measurements before touching production traffic.

#Migration planning: CBOM and Mosca's theorem

Before changing any cipher configuration, defenders must answer two questions: where is cryptography used, and which systems expire first?

Mosca's theorem frames urgency with three variables:

  • x: confidentiality shelf life of the data (how many years secrets must remain private)
  • y: migration time required to inventory, test, and upgrade systems
  • z: time until a cryptographically relevant quantum computer (CRQC) exists

Whenever x + y > z, recorded traffic is already exposed to Harvest Now, Decrypt Later (HNDL) attacks.

To compute y accurately, teams build a Cryptography Bill of Materials (CBOM) covering TLS termination proxies, internal mTLS meshes, SSH bastions, VPN concentrators, firmware/code-signing pipelines, and static data-encryption key wrappers.

  1. Discover (CBOM)Scan repos, binaries, certs, HSMs, TLS endpoints
  2. Classify (x+y vs z)Rank long-lived confidentiality links first
  3. Pilot (Hybrid KEM)Enable X25519MLKEM768 in staging and measure MTU
  4. Roll out (Agile PKI)Automate rotation, later adopt ML-DSA/SLH-DSA certs

True crypto-agility means avoiding hardcoded algorithm names, avoiding fixed-size key/signature buffers (for instance, allocating 256 bytes for a signature that becomes 3,309 bytes under ML-DSA-65), and separating cryptographic policy from business code through provider abstractions.

#Hybrid key exchange: X25519 + ML-KEM-768

During the early PQC era, security teams face two competing risks: classical X25519 will fall to a future CRQC, while newly standardized lattice schemes could harbour subtle implementation bugs or unforeseen cryptanalytic weaknesses. Hybrid key exchange protects against both by combining a classical and a post-quantum primitive in a single handshake.

In TLS 1.3, the flagship hybrid group is X25519MLKEM768 (paired with SecP256r1MLKEM768 for environments requiring NIST P-256 compliance):

TLS 1.3 hybrid key exchange (X25519MLKEM768)TLS 1.3 hybrid key exchange (X25519MLKEM768)ClientServerGenerate X25519 (X_c) and ML-KEM-768 (ek, dk)ClientHello + key_share(ek || X_c) [1216 B]Run X25519 (Y_s) and ML-KEM-768.Encaps(ek) -> (K_pq, ct)ServerHello + key_share(ct || Y_s) [1120 B]Compute K_classical and ML-KEM-768.Decaps(dk, ct) -> K_pqBoth feed K_pq || K_classical into TLS 1.3 HKDF key schedule

Because both shared secrets enter the TLS 1.3 HKDF-Extract key schedule together, an attacker must break both X25519 and ML-KEM-768 to recover session traffic keys. Notice the wire-size shift compared to classical ECDHE:

TLS 1.3 group Client key_share Server key_share Combined secret fed to HKDF
X25519 32 bytes 32 bytes 32 bytes (classical only)
MLKEM768 1,184 bytes 1,088 bytes 32 bytes (PQ only)
X25519MLKEM768 1,216 bytes 1,120 bytes 64 bytes (K_pq + K_classical)

That extra 1,184 bytes in ClientHello has an immediate network consequence. Standard 1500-byte Ethernet gives a TCP Maximum Segment Size (MSS) of roughly 1,460 bytes (or 1,440 bytes with IPv6/TCP timestamps). Classical ClientHello messages (~300 to 600 bytes) fit inside a single TCP packet. Adding X25519MLKEM768 plus SNI, ALPN, and cipher extensions frequently pushes ClientHello past 1,460 bytes, splitting it across two TCP segments.

#Lab experiments with OpenSSL 3.5 and oqs-provider

OpenSSL 3.5 added native support for FIPS 203, 204, and 205, including X25519MLKEM768, directly in its default provider. On earlier OpenSSL 3.0 to 3.4 installations, you load the Open Quantum Safe oqs-provider (backed by liboqs) alongside the default provider to run the same experiments.

First, verify which providers and KEM algorithms are active in your lab environment, then spin up a local TLS 1.3 listener and test client negotiation:

Verifying providers and running a hybrid TLS 1.3 test (OpenSSL 3.5)
$ openssl list -providers
Providers:
  default
    name: OpenSSL Default Provider
    status: active
$ openssl list -kem-algorithms | grep -E "MLKEM|X25519"
  MLKEM512 @ default
  MLKEM768 @ default
  MLKEM1024 @ default
  X25519MLKEM768 @ default
$ openssl s_server -cert lab.crt -key lab.key -groups X25519MLKEM768:X25519 -accept 8443 -www &
$ openssl s_client -connect lab.local:8443 -groups X25519MLKEM768 < /dev/null | grep -E "Protocol|Negotiated|Peer signature"
Protocol  : TLSv1.3
Negotiated TLS1.3 group: X25519MLKEM768
Peer signature type: ecdsa_secp256r1_sha256

If you are running OpenSSL 3.2 or 3.4 with oqs-provider installed instead of OpenSSL 3.5, pass -provider oqsprovider -provider default to openssl list, s_server, and s_client, and check openssl list -kem-algorithms for the exact provider group name (such as x25519_mlkem768).

Notice the last line of the s_client output: Peer signature type: ecdsa_secp256r1_sha256. That highlights a crucial distinction: X25519MLKEM768 protects the ephemeral session key against HNDL today, while the server certificate signature can remain ECDSA or RSA until your PKI transitions to ML-DSA.

To benchmark real-world impact in a lab, combine openssl s_client or openssl s_time with tcpdump / tshark (and optionally Linux tc netem delay/loss simulation):

  • Measure total handshake bytes (ClientHello, ServerHello, and certificate chain) for X25519 vs. X25519MLKEM768.
  • Count TCP segments carrying ClientHello to confirm whether your TLS configuration crosses the 1,460-byte MSS boundary.
  • Verify that clients offering X25519MLKEM768:X25519 cleanly negotiate X25519 when connecting to classical-only servers without triggering HelloRetryRequest loops unless intentionally testing fallback.

#Common mistakes

  • Skipping middlebox and MTU testing: Assuming a hybrid TLS upgrade is purely a software change ignores firewalls, load balancers, and DPI boxes that break on multi-segment ClientHello packets.
  • Hardcoding buffer limits or ASN.1 expectations: Legacy C/C++ services or embedded TLS stacks with 1 KB or 2 KB handshake buffers fail abruptly when encountering ML-KEM key shares or ML-DSA certificate chains.
  • Disabling classical fallback too early: Removing X25519 from server group lists before clients support PQC causes hard outages; keep X25519MLKEM768:X25519 ordered cleanly during transition.
  • Confusing hybrid key exchange with PQC authentication: Hybrid X25519MLKEM768 secures confidentiality against HNDL, but servers still authenticate with RSA/ECDSA certificates until ML-DSA or SLH-DSA PKI is deployed.

#Summary

  • Effective PQC migration starts with a CBOM inventory and Mosca's theorem (x + y > z) to protect long-lived confidential data first.
  • Hybrid key exchange (X25519MLKEM768) pairs X25519 with ML-KEM-768 so session confidentiality survives if either algorithm remains unbroken.
  • Because X25519MLKEM768 adds 1,184 bytes to the client key_share, ClientHello often spans two TCP segments and must be tested against middleboxes.
  • OpenSSL 3.5 natively supports X25519MLKEM768 (while OpenSSL 3.0-3.4 uses oqs-provider + liboqs), enabling practical handshake verification and byte-level benchmarking in the lab.

Проверка знаний

Войдите, чтобы проходить тест, завершать уроки и сохранять прогресс. Войти в систему

Практика: проверьте свои знания