I swapped RS256 for post-quantum ML-DSA in a real JWT flow on .NET 10. Signing and verification speed barely changed. Token size grew up to 10x, and the browser silently dropped my auth cookie.

Why bother now

Short-lived JWTs are not the most urgent quantum target. "Harvest now, decrypt later" is a threat to encrypted traffic. A signature only matters while it is being verified, so a 15-minute token cannot be forged after the fact.

The pressure comes from deadlines. NIST published the final IR 8547 on October 27, 2026. It deprecates RSA, ECDSA and EdDSA after 2030 at every key size, RSA-3072 and P-256 included, and disallows them after 2035. US federal high-value systems must move to post-quantum signatures by December 31, 2031 (CSA summary).

An auth stack spans identity providers, gateways, SDKs and every API that validates tokens. That is years of work, so 2031 is close. I wanted to know what actually breaks before planning it.

The experiment

A minimal ASP.NET Core app issues and validates JWTs signed with five algorithms. RS256 (RSA-2048) and ES256 (ECDSA P-256) are the classic baseline. ML-DSA-44, -65 and -87 come from the new System.Security.Cryptography.MLDsa class in .NET 10.

  • Payload: a realistic access token with iss, aud, sub, name, email, roles, iat and exp.
  • JWT: built by hand in about 60 lines, base64url(header).base64url(payload).base64url(signature). This keeps the experiment dependency-free and easy to inspect. Microsoft.IdentityModel has since gained ML-DSA support (PR #3479, merged May 2026), so check your version before rolling your own.
  • alg values: ML-DSA-44, ML-DSA-65, ML-DSA-87, the JOSE names.
  • Timings: 20 warm-up calls, then the average of 200. Good for orders of magnitude, not for a benchmark paper.
  • Machine: Windows (NT 10.0.26300), 16 cores, .NET 10.0.10. ML-DSA needs Windows 11 / Server 2025 with the PQC updates, or Linux with OpenSSL 3.5+.

Results

ML-DSA tokens are 5.7–10.4× larger than RS256, while signing and verification stay well under 1.5 ms.

Algorithm Public key, bytes Signature, bytes Token, chars Fits a 4 KB cookie Sign, µs Verify, µs
RS256 294 256 619 Yes 667 16
ES256 91 64 363 Yes 191 174
ML-DSA-44 1,312 2,420 3,510 Yes 542 80
ML-DSA-65 1,952 3,309 4,695 No 899 137
ML-DSA-87 2,592 4,627 6,453 No 1,183 212

All five tokens still fit in an 8 KB header line, the nginx default.

Finding 1: size is the real cost

An ML-DSA-65 token is 7.6× the size of an RS256 token and 13× the size of ES256. The signature alone is 3,309 bytes, which base64url turns into 4,412 characters.

That size lands everywhere the token travels:

  • Cookies. Browsers cap a single cookie at about 4,096 bytes. ML-DSA-65 and ML-DSA-87 do not fit.
  • Headers. nginx allows 8 KB per header line by default, and Kestrel 32 KB for all headers combined. ML-DSA-87 fits both, but load balancers, API gateways and WAFs have their own limits, and the token shares them with every other header.
  • Every request. A 4.7 KB bearer token on every API call adds real bandwidth, especially on mobile.
  • JWKS. Public keys grow from 91–294 bytes to 1.3–2.6 KB.

Finding 2: speed is a non-issue

Signing with ML-DSA-65 took 0.9 ms against 0.67 ms for RS256, and ML-DSA-44 was faster than RS256. Tokens are signed once per login or refresh, so this barely matters.

Verification is what an API does on every request. ML-DSA took 80–212 µs against 16 µs for RSA, which is cheap to verify because its public exponent is small. Yet ML-DSA-44 and -65 verified faster than ES256 (174 µs), which many teams already run in production. A tenth of a millisecond per request is noise next to a database call.

One caveat on baselines: an earlier console test showed ML-DSA-65 signing about 3× faster than RSA. That was RSA-3072, which is much slower than the RSA-2048 most JWTs use. Compare against what you actually run.

Finding 3: the silent cookie failure

The most dangerous result produced no error at all. Here is what happened in a real browser:

  1. Sign in with RS256. The token goes into an HttpOnly cookie, and /whoami says authenticated.
  2. Switch the issuer to ML-DSA-65. The server sends a 4.7 KB Set-Cookie, and the browser silently drops it.
  3. The browser keeps sending the old RS256 cookie.
  4. In my run that old cookie was signed with a key from a previous app start, so validation failed.
{ "authenticated": false, "source": "cookie", "alg": "RS256", "error": "Invalid signature.", "note": "You requested a ML-DSA-65 cookie, but the browser sent an older RS256 one: the new cookie was rejected and the old one kept." } 

Nothing points at the real cause. The server logs show an invalid RS256 token, not an oversized ML-DSA cookie. In a production rollout this looks like random logouts right after the algorithm switch. The note exists only because the demo sets a second, tiny cookie recording which alg it tried to store.

Test this in a real browser: curl does not enforce cookie size limits, so the bug never shows up there.

What to do about it

There is no single fix. Pick by where your tokens live and which rules you answer to.

Option How it works Trade-off
Use ML-DSA-44 3,510-char token fits a 4 KB cookie NIST category 2; a few extra claims overflow it; CNSA 2.0 systems must use ML-DSA-87
Keep tokens off the browser (BFF) The cookie holds a session ID; tokens stay server-side Needs a session store; the cleanest fix for web apps
Split the cookie ChunkingCookieManager stores the value as numbered chunks Every request still carries 4.7 KB+; per-domain cookie limits still apply
Reference tokens Opaque handle plus introspection at the auth server Tiny tokens, but an extra call per validation (cacheable)

ASP.NET Core already ships the chunking option: cookie authentication uses it by default for large auth tickets. You can also use it directly for your own cookies:

using Microsoft.AspNetCore.Authentication.Cookies; var cookies = new ChunkingCookieManager(); // ChunkSize = 4050 by default // Write: a 4.7 KB token becomes access_token=chunks-2, access_tokenC1, access_tokenC2 cookies.AppendResponseCookie(context, "access_token", token, options); // Read: the chunks are reassembled transparently string? token = cookies.GetRequestCookie(context, "access_token"); 

I checked this with a 4,700-character value: it was split into two chunks and read back intact.

Takeaways

  • Measure size, not speed. CPU cost barely moves; bytes grow 5–10×.
  • Map where tokens live: cookies, headers, query strings, logs, database columns, gateway limits. Each one is a place an ML-DSA token can silently stop fitting.
  • Test the failure path in a real browser. The worst bug here produced no error on either side.
  • Plan the rollover. During migration, validators must accept old and new algorithms at once. Pin the expected alg per key (kid) instead of trusting the token header.

Source code: github.com/kapitaneo/PqcJwt

Sources