Why post-quantum cryptography matters today
Post-quantum cryptography is public-key cryptography that a large quantum computer is not known to break. It matters today because traffic recorded now can be decrypted later, once such a computer exists.
Picture a hospital sending patient notes over a VPN. Someone copies the encrypted traffic and stores it. In fifteen years the notes are still private, and still on that disk.
By the end of this lesson
Note
I can explain why encrypted traffic recorded today is at risk from a future quantum computer.
Key words
| Word | What it means |
|---|---|
| Quantum computer | a machine using qubits that could run Shor's algorithm |
| Shor's algorithm | a quantum method that breaks RSA and elliptic curves |
| Harvest now, decrypt later | recording traffic today to break it in future |
| Key exchange | two computers agreeing a secret over an open network |
| KEM | key encapsulation mechanism: sending a fresh secret with a public key |
| Shelf life | how many years data must stay secret |
The cells students fill in are left blank in this preview.
What harvest now, decrypt later means
An attacker cannot break today's key exchange. But copying encrypted traffic is cheap, and disks are cheap too. So a patient attacker records now and waits.
If a large quantum computer arrives, it can recover the key exchange's secret from the recording. Every message protected by that secret then opens. Nothing you change later can protect a recording that already exists.
Worked example: how long data stays secret
| What is sent | Shelf life | Still secret in 15 years? |
|---|---|---|
| A canteen menu | 0 years | No, nobody cares |
| A card payment | 2 years | No, the card has expired |
| Payroll records | 7 years | No, but close |
| Patient notes | 30 years | Yes, and harmful if read |
The cells students fill in are left blank in this preview.
Mosca's rule: x plus y against z
The researcher Michele Mosca gave a simple test. Let x be the shelf life and y the years your migration will take. Let z be the years until a quantum computer breaks your key exchange.
If x plus y is more than z, you are already late. Nobody knows z, so try several values and see which data fails first.
Worked example: who is late?
| Data | x shelf life | y migration | x + y | z = 12: at risk? |
|---|---|---|---|---|
| Card payment | 2 | 5 | 7 | No, 5 years to spare |
| Payroll | 7 | 5 | 12 | No, 0 years to spare |
| Research data | 12 | 5 | 17 | Yes, 5 years late |
| Patient notes | 30 | 5 | 35 | Yes, 23 years late |
The cells students fill in are left blank in this preview.
What a quantum computer breaks, and what not
Shor's algorithm breaks public-key maths built on factoring or discrete logarithms. That is RSA, Diffie-Hellman, ECDH, X25519, ECDSA and Ed25519.
Symmetric ciphers and hashes are different. The best known quantum attack, Grover's algorithm, only roughly halves their strength. AES-256 and SHA-256 stay safe, so only the public-key parts need replacing.
A common mistake
Warning
Many people think nothing needs to change until a quantum computer exists. That is true for signatures, which are checked now. It is false for key exchange, because a recording made today can be broken later. So key exchange moves first.
How a KEM sends a fresh secret
A key encapsulation mechanism, or KEM, has three steps. Key generation makes a key pair. Encapsulation takes the public key alone and gives a ciphertext and a fresh 32-byte secret. Decapsulation takes the private key and the ciphertext and gives back the same secret.
ML-KEM, standardised in 2024, is the post-quantum KEM. Lesson 2 runs all three steps.
A classical exchange in the lab
In the pq-lab, the service pq is your workstation. Each Run reaches it with docker exec pq. The Runs below agree a secret with X25519, the classical exchange most HTTPS and SSH use today.
This is exactly the kind of exchange a recording could break later. Alice and Bob each make a key pair, swap public keys and derive the same secret.
Which OpenSSL is in the lab
docker exec pq openssl versionShown here, not run. Press Start lab to type it into your own lab’s terminal.
Alice makes an X25519 key pair
docker exec pq openssl genpkey -algorithm X25519 -out alice-x.pemShown here, not run. Press Start lab to type it into your own lab’s terminal.
Bob makes an X25519 key pair
docker exec pq openssl genpkey -algorithm X25519 -out bob-x.pemShown here, not run. Press Start lab to type it into your own lab’s terminal.
Copy out Alice's public key
docker exec pq openssl pkey -in alice-x.pem -pubout -out alice-x.pubShown here, not run. Press Start lab to type it into your own lab’s terminal.
Copy out Bob's public key
docker exec pq openssl pkey -in bob-x.pem -pubout -out bob-x.pubShown here, not run. Press Start lab to type it into your own lab’s terminal.
Alice derives the shared secret
docker exec pq openssl pkeyutl -derive -inkey alice-x.pem -peerkey bob-x.pub -out alice-shared.binShown here, not run. Press Start lab to type it into your own lab’s terminal.
Bob derives the shared secret
docker exec pq openssl pkeyutl -derive -inkey bob-x.pem -peerkey alice-x.pub -out bob-shared.binShown here, not run. Press Start lab to type it into your own lab’s terminal.
Compare the two secrets
docker exec pq diff -qs alice-shared.bin bob-shared.binShown here, not run. Press Start lab to type it into your own lab’s terminal.
What the Runs print
| Run | What it prints |
|---|---|
| openssl version | OpenSSL 3.5.7 9 Jun 2026 (Library: OpenSSL 3.5.7 9 Jun 2026) |
| genpkey, pkey and both derives | Nothing: each writes a file |
| diff -qs | Files alice-shared.bin and bob-shared.bin are identical |
The cells students fill in are left blank in this preview.