The Threat, Precisely

A large fault-tolerant quantum computer running Shor's algorithm (see Quantum Algorithms Explained) would break the mathematical problems behind RSA, Diffie–Hellman and elliptic-curve cryptography. Symmetric encryption and hashing are affected far less. There are two distinct risks:

  • Harvest now, decrypt later (confidentiality): an adversary records encrypted traffic today and decrypts it once a capable machine exists. Anything that must stay secret for longer than the time until that machine arrives is already exposed. Medical records, state secrets, long-lived trade secrets and personal identity data are typical examples.
  • Forge later (authenticity): signatures can only be forged once a quantum computer exists, so this risk is not retroactive. It still matters for anything with a long lifetime, such as firmware signing keys, root certificates and code-signing keys embedded in devices that cannot be updated.

Nobody knows when such a machine will arrive. The planning logic is Mosca's inequality: if the time your data must stay secret plus the time your migration takes exceeds the time until a quantum threat arrives, you are already late. Migrations take years.

What About Symmetric Crypto and Hashes?

Grover's algorithm roughly halves effective symmetric key strength. The practical guidance is simple: use AES-256 rather than AES-128 for long-lived data, and keep SHA-256 or stronger. These need no new algorithm, just sensible parameters.

The New Standards

In August 2024 the US National Institute of Standards and Technology (NIST) published the first three post-quantum standards. They run on ordinary computers; you do not need quantum hardware.

StandardAlgorithm (original name)PurposeBased on
FIPS 203ML-KEM (Kyber)Key establishment (replaces RSA/ECDH key exchange)Module lattices
FIPS 204ML-DSA (Dilithium)General-purpose digital signaturesModule lattices
FIPS 205SLH-DSA (SPHINCS+)Conservative backup signaturesHash functions only

Additional work is in progress: a Falcon-based signature standard (FN-DSA) was still being finalised at last check, and NIST selected the code-based HQC algorithm in 2025 as a backup key-establishment option. Check NIST's post-quantum project pages for current status before locking in plans.

NIST's transition guidance (published as a draft, NIST IR 8547) proposes deprecating quantum-vulnerable public-key algorithms such as RSA and elliptic curves around 2030 and disallowing them by 2035. Confirm the final dates against the published document, but the direction is clear.

The Cost: Bigger Keys and Signatures

Post-quantum algorithms are fast, often faster than RSA, but their keys and outputs are larger. Sizes from the FIPS documents for commonly chosen parameter sets:

ItemSizeCompare with
ML-KEM-768 public key1,184 bytesX25519: 32 bytes
ML-KEM-768 ciphertext1,088 bytesX25519 share: 32 bytes
ML-DSA-65 public key1,952 bytesECDSA P-256: 64 bytes
ML-DSA-65 signature3,309 bytesECDSA P-256: ~64 bytes

These sizes are why migration is an engineering project, not a library swap. TLS handshakes grow by a few kilobytes, which can push a ClientHello across a packet boundary and expose buggy middleboxes or firewalls that mishandle fragmented hellos. Certificate chains with several large signatures become heavy for constrained devices and for protocols like DNSSEC and embedded systems with small buffers.

Step 1: Build a Cryptographic Inventory

You cannot migrate what you cannot find. Start with a list of every place public-key cryptography appears: TLS endpoints, certificates, SSH keys, VPNs, code signing, JWT signing keys, database and storage encryption key wrapping, third-party APIs and hardware devices. This Python script probes TLS endpoints and reports the protocol, certificate key type and signature algorithm. It needs pip install cryptography:

#!/usr/bin/env python3
"""Minimal TLS crypto inventory: which public-key algorithms do my endpoints use?
usage: python3 inventory.py host[:port] [host[:port] ...]"""
import socket, ssl, sys
from cryptography import x509
from cryptography.hazmat.primitives.asymmetric import rsa, ec, ed25519, ed448, dsa

def describe_key(pub):
    if isinstance(pub, rsa.RSAPublicKey):  return f"RSA-{pub.key_size}"
    if isinstance(pub, ec.EllipticCurvePublicKey): return f"ECDSA-{pub.curve.name}"
    if isinstance(pub, ed25519.Ed25519PublicKey):  return "Ed25519"
    if isinstance(pub, ed448.Ed448PublicKey):      return "Ed448"
    if isinstance(pub, dsa.DSAPublicKey):          return "DSA"
    return type(pub).__name__

def inspect(host, port=443):
    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE          # we are inventorying, not validating
    with socket.create_connection((host, port), timeout=5) as raw:
        with ctx.wrap_socket(raw, server_hostname=host) as tls:
            cert = x509.load_der_x509_certificate(tls.getpeercert(binary_form=True))
            return {"host": f"{host}:{port}", "tls": tls.version(), "cipher": tls.cipher()[0],
                    "cert_key": describe_key(cert.public_key()),
                    "cert_sig": cert.signature_algorithm_oid._name,
                    "expires": cert.not_valid_after_utc.date().isoformat()}

if __name__ == "__main__":
    for target in sys.argv[1:]:
        host, _, port = target.partition(":")
        try:
            r = inspect(host, int(port or 443))
            # Every RSA/EC/EdDSA key is breakable by a large fault-tolerant quantum computer.
            print(f"{r['host']:<28} {r['tls']:<8} {r['cert_key']:<16} sig={r['cert_sig']:<22} exp={r['expires']}  [quantum-vulnerable: yes]")
        except Exception as e:
            print(f"{target:<28} ERROR {e}")

Example output against a test server we ran:

localhost:8443  TLSv1.3  ECDSA-secp256r1  sig=ecdsa-with-SHA256  exp=2026-12-06  [quantum-vulnerable: yes]

Note that the script reports the certificate's key, which is a signature (authenticity) risk. The key-exchange group negotiated in the handshake is the confidentiality risk and is not shown here; see Step 3 for how to test it. Extend the inventory with code searches (grep -rE "RSA|ECDSA|secp256|KeyPairGenerator"), dependency scans and a list of vendors who hold your keys.

Inventory by data lifetime

For each system, record how long the protected data must stay confidential. A session token that expires in minutes is low priority. A health record archive, a customer contract store or an encrypted backup kept for decades is high priority, because it is exposed to harvest-now-decrypt-later.

Step 2: Prioritise

  1. Long-lived confidential data in transit: VPNs, inter-datacenter links, and TLS to services carrying sensitive data. Fix key exchange first.
  2. Long-lived keys and signatures: firmware and code-signing keys, root and intermediate CAs, anything embedded in devices that cannot be easily updated.
  3. Everything else: short-lived tokens, web sessions without sensitive payloads, internal tooling.

Step 3: Adopt Hybrid Key Exchange

The recommended first deployment is hybrid key exchange: combine a classical algorithm with ML-KEM so the connection is secure if either is unbroken. The widely deployed TLS 1.3 group is X25519MLKEM768. Major browsers and many CDNs and cloud load balancers have enabled it, so a large share of web traffic already uses it, but check each provider's current documentation, because support differs by service and changes often.

To test a server with OpenSSL 3.5 or newer (earlier versions lack the group), request the hybrid group explicitly:

openssl version                      # needs 3.5+ for ML-KEM groups
openssl s_client -connect example.com:443 -groups X25519MLKEM768 </dev/null 2>/dev/null | grep -i "negotiated\|Server Temp Key"

If the handshake succeeds and reports the hybrid group, the server supports it. If it fails, the server or an intermediary does not. We could not run this command in our own build environment (it ships OpenSSL 3.0), so confirm the exact output on your system. Remember that a CDN or load balancer terminating TLS controls the client-facing handshake, so test the front door, and separately test the back-end hop from the balancer to your origin.

Step 4: Use ML-KEM Directly in Java

JDK 24 added ML-KEM (JEP 496) and ML-DSA (JEP 497) to the standard providers. Key encapsulation uses the javax.crypto.KEM API introduced in JDK 21. The sender creates a shared secret and a ciphertext from the receiver's public key; the receiver recovers the same secret from the ciphertext:

import java.security.KeyPair;
import java.security.KeyPairGenerator;
import javax.crypto.KEM;
import javax.crypto.SecretKey;

public class MlKemDemo {
    public static void main(String[] args) throws Exception {
        // Receiver generates a key pair (JDK 24+)
        KeyPairGenerator kpg = KeyPairGenerator.getInstance("ML-KEM-768");
        KeyPair receiver = kpg.generateKeyPair();

        // Sender encapsulates to the receiver's public key
        KEM kem = KEM.getInstance("ML-KEM");
        KEM.Encapsulator encapsulator = kem.newEncapsulator(receiver.getPublic());
        KEM.Encapsulated enc = encapsulator.encapsulate();
        SecretKey senderSecret = enc.key();
        byte[] ciphertext = enc.encapsulation();      // send this to the receiver

        // Receiver decapsulates
        KEM.Decapsulator decapsulator = kem.newDecapsulator(receiver.getPrivate());
        SecretKey receiverSecret = decapsulator.decapsulate(ciphertext);

        System.out.println("secrets match: " +
            java.util.Arrays.equals(senderSecret.getEncoded(), receiverSecret.getEncoded()));
        System.out.println("ciphertext bytes: " + ciphertext.length);   // 1088 for ML-KEM-768
    }
}

Not executed here: our build environment has JDK 21, so this snippet was written against the JEP 496 specification and not compiled by us. Run it on JDK 24 or later and confirm the algorithm names against the JDK documentation for your version. Do not use the raw shared secret directly as an encryption key; feed it through a key-derivation function (HKDF) together with context information, as protocols such as TLS and HPKE do. For real applications prefer a protocol implementation (TLS, HPKE) over rolling your own handshake.

On older JDKs, a vetted library such as Bouncy Castle provides these algorithms. Check its current documentation for supported versions and API.

Step 5: Build Crypto Agility

The lesson of the past decade is that algorithms get replaced, and the post-quantum candidates are younger than RSA. One round-one candidate (SIKE) was broken by a classical attack in 2022, after reaching a late stage of the NIST process. That is a reason for hybrids and for agility, not a reason to wait.

  • Hide algorithms behind interfaces: avoid hard-coding "RSA" or key sizes throughout the codebase; centralise crypto choices in configuration.
  • Version your formats: tokens, encrypted blobs and signed messages should carry an algorithm identifier so old and new can coexist.
  • Automate certificate rotation: short-lived certificates and automated renewal make swapping algorithms a configuration change, not a project.
  • Track dependencies: know which libraries, HSMs, smart cards and embedded devices can support new algorithms and which cannot.
  • Test for size: load-test handshakes, check MTU and fragmentation, and verify that firewalls, proxies and WAFs accept larger hellos and certificates.

What Not to Do

  • Do not roll your own post-quantum scheme or combine primitives yourself. Use standard hybrids from reviewed libraries and protocols.
  • Do not rush to post-quantum signatures everywhere. Signature risk is not retroactive, so start with key exchange and with long-lived signing keys, and watch certificate-ecosystem standards (including how browsers and CAs will handle PQ certificates) before big changes.
  • Do not rely on "quantum key distribution" as a replacement. It needs special hardware and links, solves a narrower problem, and government security agencies generally recommend post-quantum algorithms instead.
  • Do not wait for certainty about quantum timelines. The action items above are inexpensive compared with an emergency migration.

A 90-Day Starter Plan

  1. Days 1–30: run the inventory, classify data by confidentiality lifetime, and name an owner.
  2. Days 31–60: enable hybrid key exchange on your CDN or load balancer where supported; test internal VPN and service-to-service paths.
  3. Days 61–90: add algorithm identifiers to new data formats, set up automated certificate rotation, and write down which vendors and devices block migration.

To understand why the threat exists in the first place, read Quantum Computing Basics, and to calibrate how soon it might arrive see Quantum Hardware and Error Correction.

Frequently Asked Questions

What is harvest now, decrypt later?

It is an attack where an adversary records encrypted traffic today and stores it until a large quantum computer can break the key exchange. Any data that must stay confidential for longer than the time until such a machine arrives is already at risk.

Do I need to replace AES and SHA-256?

No. Grover's algorithm weakens symmetric keys only by about half their bit strength, so using AES-256 and SHA-256 or stronger is considered adequate. The urgent replacements are public-key algorithms such as RSA, Diffie–Hellman and elliptic curves.

What are ML-KEM, ML-DSA and SLH-DSA?

They are NIST's first post-quantum standards (FIPS 203, 204 and 205). ML-KEM is for key establishment, ML-DSA is the main digital signature scheme, and SLH-DSA is a conservative hash-based signature backup.

What is hybrid key exchange and why use it?

Hybrid key exchange combines a classical algorithm such as X25519 with a post-quantum one such as ML-KEM, so the connection stays secure if either is broken. X25519MLKEM768 is the common TLS 1.3 hybrid group.

Why do post-quantum algorithms make TLS handshakes larger?

Their public keys, ciphertexts and signatures are much bigger than elliptic-curve equivalents, for example an ML-KEM-768 public key is 1,184 bytes versus 32 bytes for X25519. The extra size can fragment packets and break poorly built middleboxes.