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

> Source: <https://dev.to/victhors/checking-post-quantum-tls-with-openssl-sclient-the-grep-trap-and-the-fallback-trap-14be>
> Published: 2026-12-04 15:32:54+00:00

**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 the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

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"
# TLS 1.2, AES128-GCM-SHA256
openssl s_client -connect $h:443 -servername $h -tls1_3 -groups X25519 </dev/null
# handshake fails
openssl s_client -connect $h:443 -servername $h -groups X25519:P-256 </dev/null 2>&1 | grep -E "^Protocol|Temp Key"
# TLS 1.3, P-256
```

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://builder.aws.com/content/3MyD8Ger9bI25UO3EdvcyCEK4dn/is-your-aws-connection-post-quantum-i-checked)

[https://github.com/alan-veras/aws-pqc-tls-check](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.*
