fullstack.school

Articles / security / tls / auth

Post-quantum crypto for web apps: what to change first

7 of 12
well-known hosts already negotiate X25519MLKEM768
4,587 B
an ML-DSA-65 session token: over the 4,096-byte cookie minimum
329 µs
to sign an ML-DSA-65 token, about the same as RS256 at 325 µs
Measured 5 Dec 2026 · Apple M5 Max · Node 24.22.0 · OpenSSL 3.5.8

Short answer

Post-quantum crypto for a web app starts at the edge. Check that it negotiates hybrid TLS (X25519MLKEM768); most CDNs and browsers already do. Your AES and HMAC need no change. Plan the move off RS256 and ES256 tokens next, because an ML-DSA-65 token is over 4 KB.

Contents
  1. What “harvest now, decrypt later” means for your app
  2. Check whether your edge already uses post-quantum TLS
  3. What is already safe: AES-256, SHA-256 and HMAC
  4. Where signatures bite: RS256, ES256 and webhooks
  5. What to tell your agent when it writes auth code
  6. Which deadlines apply to you
  7. Questions
  8. Sources

In the first days of December 2026 the NSA published post-quantum guidance, nine large tech companies signed a joint statement on moving to post-quantum cryptography, and a set of papers on lattice attacks landed. If you run a web app, almost all of it comes down to two places in your stack: the key exchange where TLS starts, and the signatures on your tokens. You can check the first in a minute. The second needs a plan, not a fire drill.

What “harvest now, decrypt later” means for your app

NIST describes the threat as one “in which adversaries collect encrypted data now with the goal of decrypting it once quantum technology matures.” The part of your app that threat reaches is the TLS key exchange. A classical exchange like X25519 or ECDHE can be recorded today and, if a large quantum computer ever exists, broken later. Everything that crossed that connection would be readable then: session cookies, API keys in headers, the personal data in your responses.

Signatures are a different problem. Forging an RS256 token needs the quantum computer at the moment of the attack, so a token you signed last year can’t be attacked after it has expired. That is why the key exchange comes first and the signatures come second.

Where the key exchange happens on a typical request

On most apps the key exchange that matters happens at whatever terminates TLS for the browser: your CDN or load balancer. If there’s a second TLS hop to your origin, it has its own key exchange.

Check whether your edge already uses post-quantum TLS

The fix for harvest now, decrypt later is hybrid key exchange: X25519 combined with ML-KEM (FIPS 203), defined for TLS 1.3 as X25519MLKEM768 in RFC 10024. Browsers already offer it. Chrome moved to it in version 131. The question is whether your server picks it.

The example repo has a script that connects with Node’s default TLS settings and prints the group the server chose:

npm run check-tls -- cloudflare.com github.com api.anthropic.com
PQ   cloudflare.com:443  TLSv1.3  X25519MLKEM768
NOPQ github.com:443  TLSv1.3  X25519
PQ   api.anthropic.com:443  TLSv1.3  X25519MLKEM768

The check reads the group from the live connection (src/tls.ts):

const options = { host, port, servername: host, timeout: timeoutMs };
const socket = tls.connect(options, () => {
  const key = socket.getEphemeralKeyInfo();
  const group = key && 'name' in key ? String(key.name) : null;
  resolve({
    host,
    port,
    protocol: socket.getProtocol(),
    group,
    postQuantum: group !== null && PQ_GROUPS.includes(group),
  });
  socket.end();
});

Node 24.22 bundles OpenSSL 3.5.8, and OpenSSL 3.5 offers X25519MLKEM768 first by default, so a plain tls.connect with no options is enough. Here is what twelve well-known hosts picked on 5 December 2026:

Host Key exchange
cloudflare.com, www.google.com, vercel.com, aws.amazon.com, supabase.com X25519MLKEM768
api.openai.com, api.anthropic.com X25519MLKEM768
github.com, api.github.com X25519
stripe.com, api.stripe.com X25519
registry.npmjs.org X25519, over TLS 1.2

One trap: run the same check on Node 22 and every host prints X25519, Cloudflare included. Node 22 bundles OpenSSL 3.0, which never offers the hybrid group, so no server can pick it. The repo’s scripts refuse to run on Node before 24.7 or OpenSSL before 3.5 for that reason.

If your host prints X25519, the change is usually a setting where TLS ends, not code:

  • Cloudflare has offered hybrid key exchange at its edge since 2022, and turns it on toward your origin by default for new zones. Older zones may still use classical TLS on that second hop.
  • Google Cloud load balancers negotiate X25519MLKEM768 by default since October 2026, on the client side only.
  • AWS load balancers need you to pick one of the post-quantum TLS security policies.
  • Your own server needs a TLS library that supports it, such as OpenSSL 3.5 or later.

Run the script against every hostname your users and your services connect to, including internal APIs that cross a network you don’t own.

What is already safe: AES-256, SHA-256 and HMAC

Quantum computers hurt public-key cryptography far more than symmetric cryptography. NIST’s transition report says every approved symmetric primitive with at least 128 bits of classical security meets its lowest post-quantum category, and it puts AES-256 in the highest one.

What post-quantum changes in a web app

In practice that covers a lot of a typical app:

  • Data encrypted at rest with AES-256 stays as it is.
  • HS256 session tokens, signed and verified by your own service with a shared secret, stay as they are.
  • HMAC-SHA256 webhook signatures stay as they are.

None of these need a migration. Spend the time on the next section instead.

Where signatures bite: RS256, ES256 and webhooks

NIST will deprecate quantum-vulnerable public-key algorithms after 2030 and disallow them after 2035. That covers RSA, ECDSA and EdDSA at every key size: the algorithms behind RS256, ES256 and EdDSA tokens, signed webhooks that use them, and the certificates on your servers.

The replacement for signatures is ML-DSA (FIPS 204). RFC 9964 registers it for JOSE as ML-DSA-44, ML-DSA-65 and ML-DSA-87, so a JWT can carry it today. Node 24 signs it natively:

const { privateKey, publicKey } =
  crypto.generateKeyPairSync('ml-dsa-65');
const data = Buffer.from(signingInput);
const signature = crypto.sign(null, data, privateKey);

The cost is size, not speed. The repo’s bench-tokens signs the same five-claim session token with each algorithm, 500 times each, on an Apple M5 Max with Node 24.22.0 and OpenSSL 3.5.8:

alg signature (bytes) token (bytes) fits a 4 KB cookie sign (median µs) verify (median µs)
HS256 32 212 yes 3 3
RS256 256 511 yes 325 14
ES256 64 255 yes 15 36
ML-DSA-44 2,420 3,402 yes 220 52
ML-DSA-65 3,309 4,587 no 329 76
ML-DSA-87 4,627 6,345 no 383 116

Signing with ML-DSA-65 takes about as long as RS256, and verifying takes tens of microseconds. The tokens are the problem. Browsers only have to support 4,096 bytes per cookie, name and attributes included, and an ML-DSA-65 token is 4,587 bytes before you add anything. ML-DSA-44 fits, with about 700 bytes to spare. Every request that carries the token in a header pays for those bytes too.

That points to a design choice more than an algorithm choice:

  • When one service signs and verifies, use HMAC. It’s already post-quantum safe and the token stays small.
  • When other parties verify, as with ID tokens, service-to-service tokens or public webhooks, plan for ML-DSA and test the sizes in your real headers.
  • When a token sits in a cookie, consider an opaque session ID instead, and keep the claims on the server.

What to tell your agent when it writes auth code

Your agent picks a signing algorithm every time it writes auth code, and it won’t plan for 2030 unless you tell it to. A few lines in your AGENTS.md or CLAUDE.md steer every future change:

## Auth tokens
- The signing algorithm is a config value, never hard-coded.
  The verifier pins the expected algorithm and rejects a token
  whose header names another one.
- If the same service signs and verifies, use HS256 with a
  256-bit key from the environment.
- If other services verify, sign with a key that has a `kid`
  and publish it as a JWKS, so keys and algorithms can rotate.
- Don't add new RS256 or ES256 keys. Ask before choosing
  an algorithm.
- Keys come from the environment or a secret manager, never
  from the repo.

The pinned algorithm matters on its own. The repo’s verifier refuses a token whose header names a different algorithm from the one it expects, and a test proves it. That same check blocks the old trick of a token that switches its own algorithm.

Which deadlines apply to you

Most of the dates in the news are for governments and their suppliers:

  • NIST: RSA, ECDSA and EdDSA are deprecated after 2030 and disallowed after 2035 under NIST standards. If your customers follow NIST, this is the date that reaches you.
  • CNSA 2.0: from 1 January 2027, new acquisitions for US national security systems must use the CNSA 2.0 algorithms. It matters only if you sell into those systems.
  • The EU Quantum Act: proposed on 25 November 2026, it would require post-quantum cryptography from public bodies under NIS2. It is a proposal, not law.

The lattice papers don’t change the plan. Their authors say the result is “not practical for the parameter sets of ML-KEM and ML-DSA”, Cloudflare estimates the attack needs “more resources than are available in our galaxy”, and the joint statement from ONCD, NSA and CISA says recent AI advances “do not present an immediate and widespread threat.” The NSA’s own first steps are the same ones in this article: take an inventory, then move TLS to hybrid key exchange.

So, in order: run check-tls on every hostname you serve and call, turn on hybrid key exchange wherever it prints X25519, then list every place you verify an RS256, ES256 or EdDSA signature. Switch the single-party ones to HMAC and give the rest a plan for ML-DSA before 2030.

Questions

Is AES-256 quantum safe?
Yes. NIST rates AES-256 at its highest post-quantum security category, and any NIST-approved symmetric algorithm with at least 128 bits of classical security meets the lowest one. Data encrypted with AES-256 needs no change.
Do I need to change my JWTs now?
Not this week. HS256 tokens are fine as they are. RS256 and ES256 tokens can't be forged until a large quantum computer exists, and NIST deprecates those algorithms after 2030, so plan the change instead of rushing it.
Does Node.js support X25519MLKEM768?
Yes. Node 24 bundles OpenSSL 3.5, which offers X25519MLKEM768 first by default, so a plain tls.connect from Node 24.22 negotiates it with any server that supports it. Since Node 24.7, node:crypto can also sign and verify ML-DSA.
Did the new lattice papers break ML-KEM?
No. The authors say their result is not practical for the parameter sets ML-KEM and ML-DSA use, and Cloudflare estimates the attack would need more resources than our galaxy has.

Sources

  1. NIST IR 8547: Transition to Post-Quantum Cryptography Standards (final)
  2. NIST FIPS 203, 204 and 205 announcement
  3. RFC 10024: Post-quantum hybrid key agreement for TLS 1.3
  4. RFC 9964: ML-DSA for JOSE and COSE
  5. IANA JSON Web Signature and Encryption algorithms
  6. RFC 6265: HTTP State Management Mechanism (cookie limits, section 6.1)
  7. NSA: Immediate Actions to Push Toward Post-Quantum (PP-26-4956)
  8. ONCD, NSA and CISA: Joint Statement on Recent Advances in Cryptographic and Cybersecurity Capabilities
  9. Joint statement on transition to post-quantum cryptography
  10. NSA: CNSA 2.0 FAQ v2.2
  11. European Commission: the Quantum Act explained
  12. Anthropic: lattice papers (formal-math repository)
  13. Cloudflare: PQ is still safe
  14. Cloudflare: post-quantum cryptography
  15. Cloudflare: post-quantum to origin
  16. Google Cloud: SSL policies for load balancers
  17. AWS: post-quantum key exchange for Network Load Balancers
  18. Google Security Blog: a new path for Kyber on the web
  19. OpenSSL 3.5 release notes
  20. Node.js 24.7.0 release notes (ML-KEM and ML-DSA in node:crypto)