Design a Quantum-Safe Key Exchange

Hard45 min
1 / 30
System design answer

Design a Quantum-Safe Key Exchange

Hard45 min30 sections
understanding•8 min read

Problem Statement: Key Exchange That Survives a Quantum Adversary

Frames why key establishment must move to post-quantum algorithms before anything else, and what kind of system the interviewer is really asking for.

Why key exchange has to change first

Every HTTPS request, every service-to-service call and every VPN tunnel begins with two parties agreeing on a secret over a network they do not trust. Today that agreement is almost always elliptic-curve Diffie-Hellman (X25519 or P-256), with RSA key transport still alive in older stacks. Shor's algorithm solves both the discrete-logarithm and the factoring problem in polynomial time on a large fault-tolerant quantum computer, so both families fail together. No such machine is publicly known today, but that does not make the problem a future one.

The reason is harvest now, decrypt later. An adversary who records encrypted traffic today can keep it and decrypt it on the day a cryptographically relevant quantum computer exists. Confidentiality of data you send this afternoon therefore depends on hardware from ten or fifteen years ahead. Mosca's inequality makes this concrete: if X is how long the data must stay secret, Y is how long your migration takes, and Z is the time until a capable machine exists, you are already late when X + Y > Z. Health records, source code, government traffic and long-lived credentials all have an X measured in decades.

Signatures behave differently. Forging a handshake signature needs the quantum computer at the moment of the handshake, not later. That is why the industry moved key exchange first and is moving certificates second, and why this design does the same.

What we are actually building

The interviewer is not asking you to invent a lattice scheme. NIST already did the cryptography: FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) were published on 13 August 2024. The system design problem is the platform around those primitives, which has three planes.

  1. Handshake data plane. Edge TLS 1.3 terminators, service-mesh sidecars and an SDK for custom sockets. All of them run a hybrid key exchange, X25519 plus ML-KEM-768, combined so the session key is safe if either component survives.
  2. Key material plane. Single-use ephemeral KEM keys, hourly session-ticket keys, a prekey directory for store-and-forward sessions, and HSM or KMS custody for the few long-lived keys.
  3. Crypto-agility control plane. A versioned algorithm policy, staged rollout with automatic rollback, handshake telemetry and a cryptographic inventory.

Why it is hard

  • Size. An X25519 public key is 32 bytes. An ML-KEM-768 encapsulation key is 1,184 bytes and its ciphertext is 1,088 bytes. The ClientHello no longer fits in one packet, and some middleboxes break on that.
  • Compatibility. Old clients cannot do post-quantum key exchange. The system must fall back for them without letting an attacker force the fallback on everyone.
  • Rotation. Forward secrecy depends on destroying keys on schedule: per-handshake KEM keys, ticket keys, prekeys and long-lived connection keys each have a different clock.
  • Agility. SIKE was a NIST fourth-round candidate when Castryck and Decru broke it in 2022 with a classical computer. A design that cannot swap an algorithm in hours, fleet-wide, is not finished.

Real deployments to anchor on

Chrome enabled a hybrid Kyber key exchange by default in version 124 (April 2024) and switched to the standardised X25519MLKEM768 group in version 131. Cloudflare terminates hybrid handshakes across its edge and publishes adoption on Cloudflare Radar. Signal shipped PQXDH in September 2023 and Apple shipped iMessage PQ3 in iOS 17.4 in 2024. The pattern in all of them is the same: hybrid, negotiated, measured and reversible.

Key Highlights

  • •Harvest now, decrypt later makes key exchange urgent today; signature forgery needs a quantum computer at handshake time, so authentication can migrate second.
  • •NIST published FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) on 13 August 2024.
  • •ML-KEM-768: 1,184-byte encapsulation key, 1,088-byte ciphertext, 32-byte shared secret, versus 32 bytes each way for X25519.
  • •The answer is a platform with three planes: handshake data plane, key material plane, crypto-agility control plane.
  • •Hybrid means X25519 and ML-KEM-768 are both run and combined, so one broken algorithm does not expose the session.
Say Platform, Not Algorithm
Open by saying that NIST has already chosen the primitives and that your job is negotiation, rollout, key lifecycle and observability around them. That one sentence moves the conversation from a cryptography lecture to a system design interview.
Treating Quantum as a Future Problem
Candidates often say there is time because no quantum computer exists. Recorded traffic does not expire. State the harvest-now, decrypt-later threat in your first minute and tie it to how long the data must stay confidential.

Section Rescue Kit

Buzzwords to use:

Harvest Now, Decrypt LaterMosca's InequalityKey Encapsulation Mechanism

Safe statements:

  • "I will treat the cryptographic primitives as given by NIST and spend my time on negotiation, rollout and key lifecycle."
  • "Let me separate confidentiality, which is urgent because of recorded traffic, from authentication, which can follow."
  • "Before drawing boxes I want to state which data has a secrecy lifetime longer than our migration time."
Design a Quantum-Safe Key Exchange - System Design | WinJob | WinJob