SSH algorithms
An SSH connection uses several algorithms at once, chosen by negotiation:
| Job | Examples | Note |
|---|---|---|
| User keys (login) | ssh-ed25519, ecdsa-sha2-nistp256, ssh-rsa with rsa-sha2-512 |
ed25519 the default choice |
| Host keys (server identity) | same as above | a server usually holds several, one public line in known_hosts |
| Key exchange (KEX) | curve25519-sha256, mlkem768x25519-sha256 |
how the session secret is derived |
| Ciphers (confidentiality) | chacha20-poly1305@openssh.com, aes256-gcm@openssh.com |
how traffic is encrypted |
| MACs (integrity) | hmac-sha2-512-etm@openssh.com, umac-128@openssh.com |
how tampering is detected |
- Use
ssh-ed25519for your own keys. It is shortest, fastest, and thessh-keygendefault when you skip-t. For RSA on a legacy device, use 4096 bits withrsa-sha2-512, not the SHA-1 signature algorithm. ssh-rsain a public key line is about key size; the signature algorithm is negotiated separately, so you can hold an RSA key and still avoid the old algorithm.- Legacy algorithms (
ssh-dss,diffie-hellman-group1-sha1) exist inssh -Q kexfor ancient device compatibility, not as choices. - List what your client will do:
ssh -Q kex,ssh -Q cipher,ssh -Q key. The active choices in a real connection are whatssh -vprints in Phase 3.
You need not pick these day to day, but they are negotiated. no matching key exchange method found means the sides share no algorithm, as older devices sometimes do.