Skip to main content

Keycloak and the NSA Post-Quantum Advisory: What Admins Can and Can't Do Today

· 10 min read
GR Patil
Phase Two

Bottom line: get post-quantum key exchange in front of Keycloak now, which you do at your proxy or CDN and not in Keycloak. Do not move realm keys from RSA to ES256 or EdDSA. If you already did, plan the move to RSA 3072 or ES384. You cannot sign tokens with ML-DSA in any released Keycloak yet.

On 1 December, the NSA advised operators of national security systems to "immediately accelerate the transition to post-quantum cryptography", and to verify the readiness of their vendors. Most of us don't run national security systems, but that instruction travels. A customer had already sent us six questions about RSA, elliptic curves and our post-quantum plans, and answering them meant going through every place our platform and Keycloak use cryptography.

Until Monday, our answer to "how do we get off RSA?" would have been ES256. That answer is now wrong, and this post explains why, where Keycloak is, and what we would do this month.

What the advisory says, and what it doesn't​

The advisory asks you to inventory your cryptography, and it says which algorithms to look for:

...particularly checking for algorithms not approved in CNSA 2.0 or CNSA 1.0 (e.g., DSA, elliptic curves other than P-384 or P-521 for ECDH or ECDSA, EdDSA, deprecated Diffie-Hellman groups, pairing-based cryptography).

"Elliptic curves other than P-384 or P-521" is P-256. EdDSA is Ed25519. Those are the curves behind ES256, EdDSA tokens, most passkeys and most modern TLS handshakes. RSA is not on the list. Where you can't move to post-quantum signatures yet, the advisory names the stopgaps: "RSA 3K or P-384 as the base size for roots", with a footnote that 2K "may be required for legacy support".

The press release adds that AI companies disclosed "recent discoveries that impact the security of some cryptographic systems currently in use". It doesn't say which. Cryptographers reading the advisory closely have concluded that the discovery is a classical attack that weakens 256-bit elliptic curves, and that the message is "get off 256-bit curves, and move to ML-KEM and ML-DSA much faster than you planned".

That is an inference, and we are not cryptanalysts. A joint statement from ONCD, NSA and CISA says the advances "do not present an immediate and widespread threat". But you don't need to settle the question to act on it. The advisory tells you which direction is safe, and it costs very little to stop moving in the other one.

One more thing it changes. NSA guidance has not favored hybrid key exchange until now, and this advisory explicitly allows it. That matters, because the hybrid X25519MLKEM768 is the post-quantum key exchange that is actually deployed.

Two problems with different deadlines​

Key exchange protects the confidentiality of a connection. Someone can record your traffic today and decrypt it when they are able to ("harvest now, decrypt later"). For an identity provider, that traffic contains passwords, tokens and session cookies. If 256-bit curves are weaker than we thought, "later" got closer. This is first.

Signatures prove who sent something: your token signing key, your TLS certificate, a client's signed JWT. A forged signature is only useful at the moment it is checked, so yesterday's tokens are not at risk. But this is the slow one to change, because every application that verifies a token is involved.

Where Keycloak is​

The work is tracked in one epic, Post-Quantum Cryptography (PQC) readiness (#43690), opened by Stian Thorgersen in October 2025 and targeted at Keycloak 27. If you follow one issue, follow that one.

Its non-goal is worth reading closely. PQC will not become the default, and nothing classical is deprecated or removed. The aim is readiness: algorithms an operator can opt into alongside the existing ones. That plan was written a year before this advisory, and the epic hasn't been updated since. We don't know whether the pace will change.

As of 3 December:

AreaIssueState
Hybrid key exchange in TLS 1.3#43691Open. Waits on the JDK (JEP 527), then ships behind a feature flag
OAuth 2.0 and OpenID Connect (ML-DSA tokens)#48821Open. Key providers merged to main in the last three weeks; token signing in review
SAML 2.0#50292Open. Waits on XML signature standards
WebAuthn and passkeys#50084Open. The library is upgraded; authenticators and browsers are the wait
Embedded Infinispan#50868Open
Cookies#49865Closed in August

TLS. Keycloak will not implement hybrid key exchange itself. It will use what the JDK provides. Per the issue, that arrives in an update to JDK 25, with JDK 21 to follow in the first half of 2027. The goal covers every connection, in and out: HTTPS, LDAP, JDBC and the cache.

Tokens. The standard is settled: RFC 9964 defined the ML-DSA-44, ML-DSA-65 and ML-DSA-87 algorithm names for JWTs in May. We opened the Keycloak 26.8.2 jars to see what ships. The names are defined, and there is no key provider, so a realm cannot sign with them. On main, a generated ML-DSA key provider was merged on 16 November and keystore loading on 2 December. The pull request that signs tokens is still open.

SAML. There are no registered XML signature identifiers for ML-DSA yet. That is a standards wait.

What you can do today​

Get hybrid key exchange at the front door. Almost nobody exposes Keycloak's own TLS listener to the internet. There is a CDN, a load balancer or a reverse proxy in front, and that is where the handshake happens. Check yours (you need OpenSSL 3.5 or later):

openssl s_client -connect sso.example.com:443 -tls1_3 -groups X25519MLKEM768 </dev/null 2>/dev/null |
grep "Negotiated TLS1.3 group"

If it prints X25519MLKEM768, clients that offer it are already getting it. If the handshake fails, your proxy needs an upgrade or a policy change. When we ran this against our own hosted clusters it passed, and we had configured nothing: the CDN had turned it on for every policy. On AWS, CloudFront does this by default, while an Application Load Balancer only does it if you choose a security policy with "PQ" in its name.

See which keys your realm publishes.

curl -s https://sso.example.com/realms/myrealm/protocol/openid-connect/certs |
jq -r '.keys[] | [.use, .kty, .alg, .crv // "-"] | @tsv'

A default realm on 26.8.2 shows two RSA 2048 keys, RS256 for signing and RSA-OAEP for encryption, which is the advisory's "legacy" stopgap. P-256 or Ed25519 in the crv column is what the advisory tells you to look for.

Change realm keys without downtime. A realm admin can do all of this in the console, under Realm settings > Keys > Providers. Add the new key, let applications pick it up from the JWKS, make it the one that signs, set the old key to passive so that it verifies but no longer signs, and delete it later. The providers that matter now:

You haveAddNotes
ES256 (P-256) or EdDSArsa-generated at 3072, or ES384Check that every verifier supports ES384 before choosing it
RS256 at 2048rsa-generated at 3072 or 4096Not urgent. A good way to practice a rotation
RSA-OAEP at 2048rsa-enc-generated at 3072 or 4096ecdh-generated works too, on P-384 or P-521

What you can't do yet​

  • Sign tokens with ML-DSA in a released Keycloak.
  • Sign SAML with anything but RSA. For once, that is not a problem.
  • Get hybrid key exchange from Keycloak's own TLS. That includes the connections you don't see from outside: Keycloak to the database, to LDAP, and between cluster nodes.
  • Move passkeys off P-256. Nearly every passkey is an ES256 key, and the key lives in the user's authenticator, not in your realm. Keycloak has upgraded to a WebAuthn library that supports ML-DSA, but authenticators and browsers are not there. Of everything on this list, it is the one we'd watch most closely.
  • Fix the keys other people chose. If you broker to an identity provider that signs with ES256, or one that requires an ES256 key from you (Sign in with Apple does), that is theirs to change.

What to do this month​

  1. Write down what you have. For each realm: the keys in the JWKS, which clients authenticate with signed JWTs or DPoP and with what algorithm, which identity providers you trust, and whether passkeys are in use. Then the certificate and TLS policy at each hop. Mark everything on P-256, X25519 or Ed25519.
  2. Test your front door with the command above, and make TLS 1.3 the minimum where your clients allow it. Hybrid key exchange only exists in TLS 1.3. A client that negotiates 1.2 gets a classical exchange on a 256-bit curve.
  3. Look at the hop behind the proxy. The connection from your CDN or load balancer to Keycloak carries the same passwords and tokens. It is often classical, and sometimes not encrypted at all.
  4. Stop any migration toward ES256 or EdDSA. If you are on RSA, stay there and raise the key size at your next rotation.
  5. Check your certificates. Many ACME clients now issue ECDSA P-256 certificates by default. RSA 3072 or P-384 are the stopgaps the advisory names.
  6. Rotate a realm key. If you have never done it, do it now with an RSA 3072 key. You will find the application with a hardcoded public key and the library that caches the JWKS forever, and you would much prefer to find those before the rotation is urgent. The procedure for ML-DSA will be the same.
  7. Take algorithms out of your applications. An application should read the algorithm and key from the JWKS, not from a constant. Ask whether your JWT libraries have a plan for RFC 9964.
  8. Measure your tokens. An ML-DSA-65 signature is 3,309 bytes, against 384 for RSA 3072 and 64 for ES256. Base64-encoded, that is over 4 KB before a single claim. We measured where header limits break in Keycloak HTTP 431, and several of those limits are 8 KB per header.
  9. Find out which JDK your Keycloak image runs. Hybrid TLS and ML-DSA both arrive through the JDK, and it may not be the one you think.

Phase Two hosted clusters​

The front door of every hosted cluster negotiates X25519MLKEM768 with TLS 1.3 clients that offer it. Our certificates and default realm keys are RSA, so a cluster on defaults has no 256-bit curve in its certificate or its token signatures. We are working through the same list as above for the hops behind the front door and for key sizes, and we will make ML-DSA signing available when it ships in a Keycloak release.

We'll write again when Keycloak 27 lands, as the answers here should look quite different by then!

If you have been sent a questionnaire like the one we got, our Keycloak support covers this, and our managed Keycloak clusters come with the front door already done.