cd /news/ai-safety/checking-post-quantum-tls-with-opens… · home › topics › ai-safety › article
[ARTICLE · art-181872] src=dev.to ↗ pub= topic=ai-safety verified=true sentiment=· neutral

Checking post-quantum TLS with openssl s_client: the grep trap and the fallback trap

A developer documented a method for checking whether a TLS server negotiates post-quantum key exchange using plain openssl s_client, and flagged two pitfalls that make results easy to misread: grepping only for the 'Negotiated TLS1.3 group' line hides classical X25519 fallbacks, and restricting the offered groups can silently drop a server to TLS 1.2 with RSA key transport. Testing 56 public AWS endpoints with an X25519-only offer, the developer found 29 fell back to TLS 1.2 while 27 stayed on TLS 1.3, with no AWS documentation found explaining the split.

recommendation

Check the negotiated protocol and cipher alongside the group when restricting client offers, and run a known-classical control host to confirm your script can actually report NO_PQ.

more in playbook: Running AI in production
by read4 min views1 publishedDec 4, 2026

After the US ONCD, NSA and CISA statement on December 2, 2026, and the joint statement from Amazon, Apple, Google, Microsoft and others backing a fast move to post-quantum cryptography, I wanted a quick way to check one thing: does a given server already negotiate a post-quantum key exchange?

The key exchange is the part that matters for "harvest now, decrypt later": someone records encrypted traffic today and decrypts it once a large quantum computer exists. In TLS 1.3 the post-quantum option you will see most is X25519MLKEM768, a hybrid of classical X25519 and ML-KEM-768.

You can check it with plain openssl, no account and no SDK. It is one handshake. But on my machine two details made the result easy to misread, so this post is about those.

openssl version
openssl list -tls-groups | tr ':' '\n' | grep -i mlkem

You need OpenSSL 3.5 or later, and X25519MLKEM768 in that list. I used OpenSSL 3.6.5 on Manjaro Linux.

host=kms.sa-east-1.amazonaws.com
openssl s_client -connect "$host:443" -servername "$host" \
  -groups X25519MLKEM768:X25519 </dev/null 2>&1 \
  | grep -E "^Protocol|Negotiated TLS1.3 group|Temp Key|Cipher is"

-groups X25519MLKEM768:X25519 offers the hybrid first and classical X25519 as a fallback. The server picks one.

If the server picks the hybrid group, OpenSSL 3.6.5 prints:

Negotiated TLS1.3 group: X25519MLKEM768

If it picks classical X25519, that line is not there. The group shows up somewhere else:

Peer Temp Key: X25519, 253 bits

If you grep only for Negotiated TLS1.3 group, a classical server gives you the protocol, the cipher and no group at all. That reads like "no data", not like "classical". That is why the grep above includes Temp Key.

And if the connection ends up on TLS 1.2 with RSA key transport, there is neither line. In a script I fall back from one to the other:

out="$(timeout 10 openssl s_client -connect "$host:443" \
      -servername "$host" -groups "$groups" </dev/null 2>&1)"
group="$(sed -n 's/^Negotiated TLS1.3 group: //p' <<<"$out" | head -1)"
[ -z "$group" ] && group="$(sed -n 's/^\(Peer\|Server\) Temp Key: //p' <<<"$out" | head -1)"
[ -z "$group" ] && group="none (RSA key transport)"
if [[ "$group" == *MLKEM* ]]; then status="PQ"; else status="NO_PQ"; fi

The timeout 10 is there because s_client has no connect timeout of its own.

To make sure the script could say "no", I added a control: the same handshake offering only X25519, which must come back classical.

Against sts.us-east-1.amazonaws.com it did come back classical, but not the way I expected. It did not finish TLS 1.3 with X25519. It negotiated TLS 1.2 with AES128-GCM-SHA256, which is RSA key transport: no ephemeral key, no forward secrecy.

h=sts.us-east-1.amazonaws.com
openssl s_client -connect $h:443 -servername $h -groups X25519 </dev/null 2>&1 | grep -E "^Protocol|Cipher is"
openssl s_client -connect $h:443 -servername $h -tls1_3 -groups X25519 </dev/null
openssl s_client -connect $h:443 -servername $h -groups X25519:P-256 </dev/null 2>&1 | grep -E "^Protocol|Temp Key"

I repeated the X25519-only handshake on 56 public AWS endpoints: 29 fell back to TLS 1.2 like this, 27 stayed on TLS 1.3 with X25519. I did not find AWS documentation that explains it, so I am not guessing why.

How much it matters is narrower than it looks. OpenSSL's defaults also offer P-256, and with P-256 the same endpoint stays on TLS 1.3. Only a client that offers X25519 alone gets the weaker connection, and it gets it silently, not as an error. I don't know how common those clients are.

The lesson for testing: when you restrict what the client offers, check the protocol and cipher too, not just the group.

A script that only ever prints "PQ" proves nothing. I ran three controls next to the real hosts:

Control Expected
a known host, offering only X25519 NO_PQ
does-not-exist.invalid (reserved, never resolves) DNS_FAIL
192.0.2.1 (TEST-NET, never routed) TIMEOUT

All three came back as expected.

I ran this on the home pages of seven Brazilian banks (all seven picked X25519MLKEM768) and on 56 public AWS endpoints in sa-east-1 and us-east-1 (46 picked ML-KEM, 10 stayed classical). The AWS results, compared with AWS's own readiness table, are in my case study on AWS Builder Center: https://builder.aws.com/content/3MyD8Ger9bI25UO3EdvcyCEK4dn/is-your-aws-connection-post-quantum-i-checked

https://github.com/alan-veras/aws-pqc-tls-check

Have you checked what your own HTTP client or SDK offers? I'd like to know which version first gave you X25519MLKEM768.

This article was created with the help of AI. The commands and results come from runs on my own machine on December 3, 2026.

── more in #ai-safety 4 stories · sorted by recency
── more on @openssl 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/checking-post-quantu…] indexed:0 read:4min 2026-12-04 · —