What post-quantum SSH is
Post-quantum SSH means the key exchange that starts every SSH session uses ML-KEM as well as a classical method. OpenSSH 10 does this by default, so most people already use it without knowing.
Admins copy files, run backups and manage servers over SSH every day. A recording of those sessions is worth breaking later, so SSH moved early.
By the end of this lesson
Note
I can read which key exchange an SSH connection used and say whether it is post-quantum.
Key words
| Word | What it means |
|---|---|
| SSH | secure shell, for logging in to and controlling another computer |
| KEX | short for key exchange, the first step of an SSH session |
| mlkem768x25519-sha256 | OpenSSH's hybrid of ML-KEM-768 and X25519 |
| Host key | the server's signing key, which proves it is the right server |
| Verbose mode | ssh -v, which prints each step of a connection |
The cells students fill in are left blank in this preview.
OpenSSH moved to post-quantum early
OpenSSH 9.0, in 2022, made sntrup761x25519-sha512 its default, a hybrid using a lattice KEM called Streamlined NTRU Prime. OpenSSH 9.9 added mlkem768x25519-sha256, and OpenSSH 10.0 made it the default.
Both are hybrids with X25519, so both count as post-quantum. The host key is still Ed25519, a classical signature. That is checked live, so a recording cannot be used to break it later.
Worked example: SSH key exchanges
| Name | What it is | Post-quantum? |
|---|---|---|
| mlkem768x25519-sha256 | ML-KEM-768 with X25519, the default in OpenSSH 10 | Yes, hybrid |
| sntrup761x25519-sha512 | NTRU Prime with X25519, the default in 9.0 to 9.9 | Yes, hybrid |
| curve25519-sha256 | X25519 alone | No |
| ecdh-sha2-nistp256 | Elliptic curve P-256 alone | No |
The cells students fill in are left blank in this preview.
How SSH agrees a key exchange
Each side sends its list of key exchanges. SSH picks the first one in the client's list that the server also has. If they share none, the connection stops before any login.
In the lab, ssh sshd reaches the default server on port 2222. ssh legacy reaches the same server set up like an old one on port 2200, offering only classical methods.
Which OpenSSH is the client
docker exec pq ssh -VShown here, not run. Press Start lab to type it into your own lab’s terminal.
List the post-quantum key exchanges
docker exec pq sh -c "ssh -Q kex | grep -E 'mlkem|sntrup'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
The client's list, in order
docker exec pq sh -c "ssh -G sshd | grep ^kexalgorithms"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Log in and run one command
docker exec pq ssh sshd whoamiShown here, not run. Press Start lab to type it into your own lab’s terminal.
Which key exchange was agreed
docker exec pq sh -c "ssh -v sshd true 2>&1 | grep 'kex: algorithm'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Which OpenSSH is the server
docker exec pq sh -c "ssh -v sshd true 2>&1 | grep 'remote software version'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the Runs print
| Run | What it prints |
|---|---|
| ssh -V | OpenSSH_10.0p2 Debian-7+deb13u4, OpenSSL 3.5.7 9 Jun 2026 |
| ssh -Q kex, filtered | sntrup761x25519-sha512, [email protected], mlkem768x25519-sha256 |
| ssh -G, filtered | kexalgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,... then the classical ones |
| ssh sshd whoami | abc, the account on the server |
| kex: algorithm | debug1: kex: algorithm: mlkem768x25519-sha256 |
| remote software version | debug1: Remote protocol version 2.0, remote software version OpenSSH_10.3 |
The cells students fill in are left blank in this preview.
Force a classical key exchange
docker exec pq sh -c "ssh -v -o KexAlgorithms=curve25519-sha256 sshd true 2>&1 | grep 'kex: algorithm'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Connect to the old-style server
docker exec pq sh -c "ssh -v legacy true 2>&1 | grep 'kex: algorithm'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Ask the old server for ML-KEM only
docker exec pq sh -c "ssh -o LogLevel=INFO -o KexAlgorithms=mlkem768x25519-sha256 legacy true 2>&1 | cut -d: -f2-"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
The old server's own list
docker exec sshd sh -c "/usr/sbin/sshd.pam -T -f /tmp/sshd/legacy_config | grep ^kexalgorithms"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the classical Runs print
| Run | What it prints |
|---|---|
| Forced curve25519 | debug1: kex: algorithm: curve25519-sha256 |
| ssh legacy | debug1: kex: algorithm: curve25519-sha256 |
| ML-KEM only to legacy | no matching key exchange method found. Their offer: curve25519-sha256,ecdh-sha2-nistp256,ext-info-s,[email protected] |
| sshd -T on the old server | kexalgorithms curve25519-sha256,ecdh-sha2-nistp256 |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think a new SSH client protects every connection. The server has a say: an old server agrees classical X25519, and the login works with no question asked. Read the kex line, or fix the server, before you trust a session.