What hybrid post-quantum TLS is
Hybrid post-quantum TLS joins a classical key exchange and ML-KEM in one TLS 1.3 handshake. The group X25519MLKEM768 is already offered by major browsers and servers, so much web traffic is protected this way today.
A padlock does not tell you which group was used. In this lesson you read the group the server agreed, and see what makes it change.
By the end of this lesson
Note
I can find which key exchange group a TLS 1.3 server agreed and say whether it is hybrid.
Key words
| Word | What it means | Example |
|---|---|---|
| TLS 1.3 | the protocol behind HTTPS, in its current version | |
| Group | the key exchange method a TLS handshake uses | X25519MLKEM768 |
| Key share | the public value each side sends for a group | |
| Hybrid | a classical and a post-quantum method joined together | |
| s_client | OpenSSL's command-line TLS client |
The cells students fill in are left blank in this preview.
Why join two methods?
ML-KEM is new, and new maths sometimes fails. X25519 is old and well tested, but a quantum computer breaks it. A hybrid runs both and mixes their two secrets into the session keys.
An attacker then has to break both. A quantum computer breaks X25519, and a flaw found in ML-KEM would not break X25519, so the connection stays safe if either one holds.
Worked example: the X25519MLKEM768 key shares
| Who sends | ML-KEM-768 part | X25519 part | Key share |
|---|---|---|---|
| Client | Public key, 1184 bytes | Public key, 32 bytes | 1216 bytes |
| Server | Ciphertext, 1088 bytes | Public key, 32 bytes | 1120 bytes |
| Both | Secret, 32 bytes | Secret, 32 bytes | Mixed into the session keys |
The cells students fill in are left blank in this preview.
How the group is agreed
The client lists the groups it supports and sends a key share for its first choice. If the server has that group, it answers with its own key share. If not, it asks the client again for another group they share.
In the lab, the group agreed is always the first in the client's list that the server has. When they share none, the handshake fails.
List the TLS 1.3 groups OpenSSL knows
docker exec pq openssl list -tls1_3 -tls-groupsShown here, not run. Press Start lab to type it into your own lab’s terminal.
Connect with OpenSSL's defaults
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief 2>&1 | grep -v Connecting"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the default connection prints
| Line | What it means |
|---|---|
| Protocol version: TLSv1.3 | The protocol version |
| Peer certificate: CN=tls | The server's name in its certificate |
| Signature type: mldsa65 | The certificate is signed with ML-DSA, lesson 4 |
| Verification: OK | The certificate chains to the lab's root |
| Negotiated TLS1.3 group: X25519MLKEM768 | The hybrid group was agreed |
The cells students fill in are left blank in this preview.
Offer only the classical X25519
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief -groups X25519 2>&1 | grep -E 'group|Temp'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Offer only the pure MLKEM768
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief -groups MLKEM768 2>&1 | grep -E 'group|Temp'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Put X25519 before the hybrid
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief -groups X25519:X25519MLKEM768 2>&1 | grep -E 'group|Temp'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
A first choice the server lacks
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief -groups secp256r1:MLKEM768:X25519 2>&1 | grep -E 'group|Temp'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Offer a group the server lacks
docker exec pq sh -c "openssl s_client -connect tls:4433 -servername tls -CAfile /keys/tls-ca.crt -brief -groups secp256r1 2>&1 | grep -o 'alert handshake failure'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the other Runs print
| Client offers | What it prints | Kind |
|---|---|---|
| X25519 | Peer Temp Key: X25519, 253 bits | Classical |
| MLKEM768 | Negotiated TLS1.3 group: MLKEM768 | Post-quantum only |
| X25519:X25519MLKEM768 | Peer Temp Key: X25519, 253 bits | Classical, by the client's order |
| secp256r1:MLKEM768:X25519 | Negotiated TLS1.3 group: MLKEM768 | The first shared group |
| secp256r1 | alert handshake failure | No shared group |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think that if both sides support the hybrid, they always use it. The client's order decides. A client that lists X25519 first gets X25519 from this server, with no warning. Check the group line, not only the padlock.