Most SSH estates still carry a mix of key types chosen years apart, and some of them now fail to connect, quietly use weak signatures or cannot be protected by hardware. OpenSSH has changed its defaults several times: it disabled SHA-1 RSA signatures in 2021, made Ed25519 the default key type in 2023 and removed DSA entirely in 2025. This reference compares the SSH key algorithms and sizes in use today, FIDO security key types and OpenSSH certificates, gives their current status, and sets out how to choose a type and migrate away from deprecated ones. It is for system administrators, platform engineers and the people who set SSH policy. For the wider lifecycle of discovering, rotating and retiring keys, see the SSH Key Management Guide.
Status: checked against the OpenSSH manual pages and release notes in November 2026. Defaults move between releases, so confirm against the version you run with ssh -V and ssh -Q key.
Key takeaways
- Ed25519 is the default and the right choice for most new keys.
ssh-keygenhas generated Ed25519 by default since OpenSSH 9.5 (October 2023); keys are fixed length, small and fast. - RSA is fine at 3072 bits with SHA-2 signatures. The
ssh-keygendefault RSA size is 3072 bits, and only thersa-sha2-256andrsa-sha2-512signature algorithms should be accepted; SHA-1ssh-rsahas been off by default since OpenSSH 8.8. - DSA is gone. OpenSSH 9.8 disabled DSA at compile time and OpenSSH 10.0 (April 2025) removed it, so any remaining
ssh-dsskey is a migration task, not a configuration choice. - FIDO keys bind the private key to hardware. The
ecdsa-skanded25519-sktypes keep the private key inside a security key, so a stolen key file alone is of limited use. - Certificates solve the trust problem raw keys cannot. An OpenSSH certificate adds principals, a validity window and a CA signature to any key type, which ends
authorized_keyssprawl and trust-on-first-use host keys.
Key types at a glance
Key type (ssh-keygen -t) | Wire algorithm names | Sizes | Status in current OpenSSH | Notes |
|---|---|---|---|---|
ed25519 | ssh-ed25519 | Fixed (32-byte public key, 64-byte signature) | Default since 9.5; recommended | Defined in RFC 8709; best general choice |
rsa | rsa-sha2-512, rsa-sha2-256; legacy ssh-rsa | Minimum 1024, default 3072 bits | Supported with SHA-2; ssh-rsa (SHA-1) disabled by default since 8.8 | Use 3072 bits or more; widest compatibility with old appliances |
ecdsa | ecdsa-sha2-nistp256, -nistp384, -nistp521 | 256, 384 or 521 bits | Supported | Use where NIST curves are required by policy |
ed25519-sk | [email protected] | Fixed | Supported since 8.2 | Needs a FIDO token that implements Ed25519 |
ecdsa-sk | [email protected] | Fixed (P-256) | Supported since 8.2 | P-256 is mandatory for FIDO tokens, so widest hardware support |
mldsa44-ed25519 | ssh-mldsa44-ed25519 | Fixed | Listed by current ssh-keygen and in default accepted algorithms | Post-quantum composite; the IETF specification is still a draft, see the PQC SSH Migration Guide |
dsa | ssh-dss | 1024 bits | Removed in 10.0 | Replace immediately |
Every type except DSA also has a certificate form, named with a [email protected] suffix, for example [email protected].
Approximate security strength, using the equivalences in NIST SP 800-57 Part 1:
| Security strength | RSA modulus | Elliptic curve | SSH options |
|---|---|---|---|
| 112 bits | 2048 | 224 to 255 bits | RSA 2048 (minimum for new keys) |
| 128 bits | 3072 | 256 to 383 bits | RSA 3072, ECDSA P-256, Ed25519, both sk types |
| 192 bits | 7680 | 384 to 511 bits | ECDSA P-384 |
| 256 bits | 15360 | 512 bits and above | ECDSA P-521 |
None of these classical algorithms resists a future cryptographically relevant quantum computer. For signatures, that is a risk only from the point such a machine exists, unlike key exchange, which faces harvest-now-decrypt-later risk.
RSA
RSA keys remain common because every SSH implementation supports them. The key itself is not the problem; the signature hash is. RFC 8332 (March 2018) defines rsa-sha2-256 (recommended) and rsa-sha2-512 for the same RSA keys, and describes the original SHA-1 ssh-rsa as deficient. OpenSSH 8.8 (September 2021) disabled ssh-rsa signatures by default, noting that SHA-1 chosen-prefix collisions cost under USD 50,000.
- Size: generate at least 3072 bits (the
ssh-keygendefault). RFC 8332 points to the NIST position that keys under 2048 bits are not acceptable for US government use. Do not generate 1024-bit keys, even thoughssh-keygenstill allows them. - Server floor:
sshd_configRequiredRSASizedefaults to 1024 bits; raise it to 2048 or 3072 to refuse weak keys outright. - Legacy peers: if a device only speaks
ssh-rsa, the 8.8 release notes show a per-hostHostkeyAlgorithms +ssh-rsaandPubkeyAcceptedAlgorithms +ssh-rsaoverride in~/.ssh/config, as a temporary fix only. Scope it to that host and track it as an exception.
When to choose RSA: when you must reach systems that do not support Ed25519, such as older network appliances or hardware security modules limited to RSA.
ECDSA
ECDSA keys use the NIST curves P-256, P-384 and P-521 (ssh-keygen -t ecdsa -b 256|384|521). They are smaller and faster than RSA at the same strength.
- Strengths: NIST curves are widely accepted in compliance regimes that require approved algorithms, and P-256 is the curve FIDO tokens must support.
- Cautions: ECDSA signatures depend on a fresh random nonce for every signature; a weak or repeated nonce can expose the private key. Modern implementations derive nonces safely, but this is one reason many teams prefer Ed25519, which is deterministic by design.
- Size choice: P-256 gives about 128-bit strength and is enough for most uses; choose P-384 where a policy demands 192-bit strength.
Ed25519
Ed25519 is an EdDSA signature scheme on Curve25519. RFC 8709 (February 2020, Proposed Standard) defines ssh-ed25519 with a 32-octet public key and a 64-octet signature, and ssh-ed448, which OpenSSH does not offer. OpenSSH 9.5 made Ed25519 the ssh-keygen default, describing the public keys as very convenient because of their small size.
- Why it is the default: fixed size (the
-bflag is ignored), deterministic signatures with no per-signature randomness, fast signing and verification, and a short public key that is easy to read and paste. - Compliance: NIST added EdDSA to FIPS 186-5 (February 2023). Check whether your FIPS-validated module includes it before assuming it is allowed in a FIPS mode environment.
- Compatibility: supported by OpenSSH since 6.5 and by current major SSH clients and servers, but some old embedded devices and appliances still lack it.
FIDO keys
OpenSSH 8.2 (February 2020) added the FIDO authenticator-backed types ecdsa-sk and ed25519-sk. The private key never leaves the token; the file on disk holds only a key handle. A user must normally touch the token for each signature.
| Option | Where it is set | Effect |
|---|---|---|
-O resident | ssh-keygen | Stores the key handle on the token so it can be loaded on another machine with ssh-keygen -K or ssh-add -K; protect with a PIN |
-O verify-required | ssh-keygen | Requires user verification (for example a PIN) for each signature |
-O write-attestation | ssh-keygen | Saves attestation data that can show the key was made in trusted hardware |
PubkeyAuthOptions touch-required | sshd_config | Server insists the signature proves user presence |
PubkeyAuthOptions verify-required | sshd_config | Server insists the signature proves user verification, such as a PIN |
- Which sk type: FIDO tokens must implement P-256, so
ecdsa-skworks with the widest range of hardware; OpenSSH notes that Ed25519 support on tokens is less common. Useed25519-skwhere your fleet of tokens supports it. - Limits: touch-per-use makes sk keys a poor fit for unattended automation. For service accounts, use short-lived certificates or a hardware-backed agent instead.
The Security Keys for SSH guide covers rollout, recovery and agent behaviour in depth.
Certificates
An OpenSSH certificate is a public key signed by a certificate authority (CA) key, in OpenSSH's own format, not X.509. Any of the key types above can be certified. ssh-keygen -s signs a key with the CA key, -I sets the key identity that servers log, -n sets the allowed principals (user or host names) and -V sets the validity interval.
| Concern | Raw public keys | OpenSSH certificates |
|---|---|---|
| How a server trusts a user | Each key listed in each account's authorized_keys | One CA key in TrustedUserCAKeys; principals decide which account |
| How a client trusts a host | Trust on first use in known_hosts | @cert-authority line for the host CA |
| Expiry | None; keys live until removed | Built in with -V, so short-lived access is the norm |
| Revocation | Find and delete the key everywhere | Expiry plus a key revocation list in RevokedKeys |
| Audit | Fingerprint only | Key identity and serial in server logs |
| Main risk | Sprawl and orphaned keys | The CA key itself, which must be tightly protected |
- Principals are mandatory in practice: the
sshd_configmanual notes that certificates without a list of principals are not permitted for authentication withTrustedUserCAKeys. - Revocation file safety: if the
RevokedKeysfile is unreadable, sshd refuses public key authentication for all users, so deploy it carefully. - CA key type: the default
CASignatureAlgorithmsaccepts Ed25519, ECDSA, sk types and RSA with SHA-2. An Ed25519 CA key, ideally held in hardware, is a sound default.
See the SSH Protocol and Certificate Authority Guide for CA design and the SSH Keys vs SSH Certificates comparison.
Choosing and migrating
| Use case | Recommended type | Fallback |
|---|---|---|
| Admin and developer interactive access | ed25519-sk or ecdsa-sk with a certificate | Ed25519 with a passphrase and certificate |
| Automation and service accounts | Ed25519 with a short-lived certificate | Ed25519 with a forced command and from= restriction |
| Host keys | Ed25519, signed by a host CA | ECDSA P-256 or RSA 3072 alongside Ed25519 for old clients |
| FIPS-constrained systems | ECDSA P-256 or P-384, or RSA 3072 with SHA-2 | Ed25519 if your validated module includes EdDSA |
| Legacy appliances | RSA 3072 with rsa-sha2-256 | Scoped ssh-rsa exception while the device is replaced |
A phased migration away from DSA, short RSA and SHA-1 signatures:
- Inventory: collect every
authorized_keysentry and host key with its type and size (ssh-keygen -l -fshows bits and type). See How to Find ssh authorized keys across a server fleet. - Measure what is negotiated: raise sshd
LogLeveltoVERBOSEon a sample of servers to log the key type and fingerprint used for each login, and find who still uses DSA, RSA under 2048 bits orssh-rsa. - Issue replacements: generate Ed25519 or sk keys for those users and services, and add them alongside the old ones.
- Pilot the restriction: on a pilot ring, set
PubkeyAcceptedAlgorithmsandHostKeyAlgorithmsto excludessh-rsa, and raiseRequiredRSASizeto 2048 or 3072. Keep console or out-of-band access in case a change locks you out. - Roll out and remove: extend to all servers, then delete the old keys from
authorized_keysand old host key files. Rollback is reverting thesshd_configlines on the affected ring. - Move to certificates: once keys are modern, introduce user and host CAs so future algorithm changes mean reissuing certificates, not editing thousands of files.
Small and large estates: a team with a few dozen servers can move straight to Ed25519 keys and add certificates later. Large estates gain most from certificates first, because they turn migration into a CA policy change.
Where identity fits
Most SSH keys in a large estate belong to automation, not people: deployment pipelines, backup jobs, configuration management and service accounts. These are non-human identities with long-lived credentials, and attackers target both the keys (ATT&CK T1552.004 Private Keys) and the files that trust them (T1098.004 SSH Authorized Keys). Choosing a strong key type is only the start; each key needs an owner, a purpose and an expiry. See the Certificate vs Federated vs Secret Based Machine Identity guide.
Detection and measurement
- Weak type share: percentage of keys that are DSA, RSA under 3072 bits or only usable with
ssh-rsa; target zero. - Hardware-backed share: percentage of interactive admin logins using sk keys.
- Certificate coverage: percentage of servers trusting a user CA, and of hosts presenting a host certificate.
- Exception count: number of hosts with
+ssh-rsaoverrides, each with an owner and end date. - Login evidence: sshd
Accepted publickeylog lines atVERBOSEinclude the key type and fingerprint, which feed the metrics above.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 Authenticator Management; SC-12 Cryptographic Key Establishment and Management; SC-13 Cryptographic Protection; AC-17 Remote Access | Key strength, lifecycle and approved algorithms for remote access |
| NIST CSF 2.0 | PR.AA-01 | Credentials for users, services and hardware are managed |
| MITRE ATT&CK | T1552.004 Private Keys; T1098.004 SSH Authorized Keys | Theft of keys and persistence through trusted key files |
| IETF | RFC 8709; RFC 8332 | Ed25519 and RSA SHA-2 algorithm definitions |
Practitioner checklist
- Generate new keys as Ed25519, or as
ed25519-skorecdsa-skfor privileged humans. - Generate RSA only where required, at 3072 bits or more, and set
RequiredRSASizeto at least 2048. - Remove every DSA key; it no longer works with OpenSSH 10.0 and later.
- Keep
ssh-rsaout of accepted algorithms, with scoped, dated exceptions only for named legacy hosts. - Require
verify-requiredortouch-requiredfor FIDO keys on sensitive servers. - Introduce user and host CAs, with an Ed25519 CA key kept in hardware.
- Log key type and fingerprint at
VERBOSEand track the weak type share monthly. - Give every automation key an owner, purpose and expiry, ideally via short-lived certificates.
Standards and references
- OpenBSD: ssh-keygen(1) manual page
- OpenBSD: sshd_config(5) manual page
- IETF: RFC 8709 Ed25519 and Ed448 Public Key Algorithms for SSH
- IETF: RFC 8332 Use of RSA Keys with SHA-256 and SHA-512 in SSH
- OpenSSH: Release Notes 8.2
- OpenSSH: Release Notes 8.8
- OpenSSH: Release Notes 10.0
- NIST: SP 800-57 Part 1 Rev 5, Recommendation for Key Management
Related NHI Mgmt Group resources: SSH Key Management Guide · SSH Protocol and Certificate Authority Guide · OpenSSH Server Hardening Guide · Security Keys for SSH · SSH Key Compromise Response Playbook