Skip to content

Webinar: Register For Our Upcoming Webinar

Register Now

Comparing SSH Keys: RSA, DSA, ECDSA or EdDSA

Comparing SSH Keys

SSH keys are a foundational part of secure remote access, yet many teams still use them without fully understanding the trade-offs between the available algorithms. Choosing the right SSH key type matters because it affects security, compatibility, performance and long-term maintainability. As of 2025, the most widely adopted SSH authentication algorithms are RSA, ECDSA, and EdDSA (Ed25519), while DSA has been deprecated and disabled across all modern SSH implementations. In environments governed by compliance frameworks like PCI-DSS, NIST SP 800-53 or SOC 2, the choice of SSH key algorithm can directly impact audit outcomes and regulatory posture, making algorithm selection a governance concern as well as a technical one.

This blog breaks down the four SSH key algorithms you are most likely to encounter: RSA, DSA, ECDSA and EdDSA. EdDSA is a family of digital signature schemes rather than a single algorithm, with different variants instantiated over different elliptic curves — the two standardized in RFC 8032 are Ed25519 (built on Curve25519, offering roughly 128-bit security) and Ed448 (built on Curve448, offering roughly 224-bit security for higher-assurance workloads).

In SSH practice, EdDSA almost always refers to Ed25519, which is why the two terms are often used interchangeably. This guide explains the cryptographic foundations, strengths, weaknesses and real-world applicability of each algorithm. Whether you are a system administrator hardening production servers, a DevOps engineer building CI/CD pipelines or a security consultant auditing an enterprise’s SSH infrastructure, it will help you make an informed decision about which key type to deploy and when to migrate away from older ones.

What Are SSH Keys?

SSH keys are asymmetric cryptographic key pairs used to authenticate users or servers over SSH without sending passwords across the network. Each pair has a private key that stays on your device and a public key that is copied to the server or service you want to access. When you connect, the server verifies that you possess the private key corresponding to the authorized public key.

The security of SSH key authentication rests on asymmetric (public-key) cryptography. The private key and public key are mathematically linked such that a message signed with the private key can only be verified with the matching public key, yet the private key cannot be derived from the public key in any practical amount of time. This asymmetry is what allows the private key to remain secret on the client while the public key is freely distributed to every server the user needs to access.

The specific algorithm — RSA, DSA, ECDSA or EdDSA — defines the mathematical problem on which this asymmetry is built and therefore dictates how signatures are generated, how they are verified, and how much computational effort each operation requires.

Under the hood, the SSH authentication handshake works as follows:

  1. The client initiates an SSH connection to the server and presents its public key.
  2. The server checks whether that public key is listed in the authorized_keys file for the target user account.
  3. If the key is found, the server generates a random challenge and encrypts or signs it using the client’s public key.
  4. The server sends the challenge to the client.
  5. The client decrypts or signs the challenge using its private key and sends the response back to the server.
  6. The server verifies the response, confirming that the client possesses the corresponding private key without the key itself ever being transmitted over the network.

It is worth noting that SSH keys are not just used for interactive logins. They also secure file transfers (SCP, SFTP), port forwarding, tunneling, Git operations and automated machine-to-machine communication.

The Four Algorithms

There are four SSH key types commonly discussed in practice: RSA, DSA, ECDSA and EdDSA. Among these, RSA is the historical default, DSA is legacy, ECDSA is an elliptic-curve alternative and EdDSA, usually represented by Ed25519 in SSH, is the modern default for most new setups. OpenSSH’s own tooling reflects this shift: ssh-keygen supports RSA, ECDSA and Ed25519 and modern releases default to Ed25519 when no type is specified.

RSA

RSA is based on the mathematical difficulty of factoring very large integers into primes. Because of that, RSA security depends heavily on key length; older 1024-bit keys are no longer considered safe, while 3072-bit or 4096-bit keys are more appropriate for modern use. OpenSSH still supports RSA keys and ssh-keygen allows generating them with the -t rsa option.

Strengths of RSA

RSA’s biggest strength is compatibility. It works with older servers, older network devices, older automation tools and older enterprise products that may not support newer algorithms. If you are operating in an environment with mixed generations of infrastructure, RSA is often the least disruptive option.

Another advantage is maturity. RSA has been studied for decades and many administrators are comfortable auditing, rotating and troubleshooting RSA-based SSH access. That familiarity still matters in large enterprises where operational risk can be more important than cryptographic elegance.

Limitations of RSA

RSA keys are much larger than elliptic-curve keys, which means more storage, more bandwidth and slightly slower operations. For SSH authentication, this is usually acceptable, but at scale it can add overhead compared to newer algorithms. Also, many of the deprecation discussions around RSA are really about the older ssh-rsa SHA-1 signature scheme rather than RSA itself; modern RSA can still be used with SHA-2 signatures.

Real-Life Example

A common RSA use case is a legacy bastion host in a financial or industrial environment. Suppose you maintain a network appliance from an older vendor that only accepts RSA keys. In that case, a 4096-bit RSA key may be the only practical choice until the hardware or firmware is upgraded.

DSA

DSA was once a standard digital signature algorithm and was historically used in SSH, but it has long since fallen out of favor. In OpenSSH and most modern guidance, DSA is treated as a legacy option rather than a recommended choice.

Why is DSA Discouraged?

DSA is discouraged for several concrete, well-documented reasons. First, the SSH protocol hard-limits DSA keys to 1024 bits, which corresponds to only about 80 bits of symmetric-equivalent security — well below the 112-bit minimum that NIST has required for any new cryptographic work since 2014. Second, DSA signatures depend critically on a secret, per-signature random value known as a nonce. If that nonce is ever repeated or is predictable even slightly, the private key can be recovered algebraically from just two signatures.

Real-world incidents (from the PlayStation 3 jailbreak to compromised Bitcoin wallets) have repeatedly demonstrated this class of failure. Third, NIST formally deprecated DSA for signature generation in FIPS 186-5 (2023), permitting only legacy verification, which makes DSA keys a compliance liability in any regulated environment.

OpenSSH’s position reflects these weaknesses directly: OpenSSH 7.0 and greater disables the ssh-dss (DSA) public key algorithm on the grounds that it is weak, and the project recommends against its use. On any reasonably modern system, DSA keys will simply not work without explicitly re-enabling a deprecated algorithm — which is itself a signal that this is a migration problem, not a design choice.

Real-Life Example

You might still encounter DSA in an inherited environment where a long-lived server has never been modernized. For example, a university lab, an old internal build system or a vendor appliance may still have a DSA key configured from years ago. In those cases, the right response is usually migration planning, not continued adoption.

ECDSA

ECDSA uses elliptic curve cryptography, which provides strong security with much smaller keys than RSA. SSH implementations typically support curve sizes such as 256, 384 and 521 bits and ssh-keygen enforces these specific sizes. This makes ECDSA efficient and compact.

Strengths of ECDSA

ECDSA is attractive because it offers good performance and smaller key sizes, which can be useful in constrained environments. Smaller keys mean less data to store, copy and transmit and that can matter on embedded systems, automated pipelines or large fleets of servers.

Limitations of ECDSA

ECDSA is more sensitive to correct implementation and curve selection than Ed25519. While it is still secure when implemented properly, many teams prefer Ed25519 because it is simpler, harder to misuse and generally more ergonomic in modern tooling. ECDSA also lacks some of the “it just works” convenience that Ed25519 has in contemporary SSH workflows.

Real-Life Example

A realistic ECDSA use case is a constrained production environment where key size matters, such as a fleet of small VMs or embedded devices. If the software stack already supports elliptic curves and you want compact credentials, ECDSA is a reasonable option. However, if you are starting fresh, Ed25519 is usually the better default.

Implementation Services for Key Management Solutions

We provide tailored implementation services of data protection solutions that align with your organization's needs.

EdDSA / Ed25519

EdDSA is a modern digital signature scheme and in SSH practice, it almost always refers to Ed25519. OpenSSH added Ed25519 support in version 6.5 and described it as offering better security than ECDSA and DSA with good performance. Modern ssh-keygen defaults to Ed25519 because it is widely considered the best general-purpose SSH key type today.

Strengths of Ed25519

Ed25519 is fast, compact and secure by default. It has small keys, efficient operations and a design that reduces many of the pitfalls associated with older schemes. For everyday use — developers logging into servers, administrators connecting to bastions or automation systems accessing infrastructure — Ed25519 is usually the best combination of safety and convenience.

Limitations of Ed25519

The main limitation is compatibility with older systems. Very old SSH servers, appliances or managed services may not support Ed25519, which forces teams to keep RSA around as a fallback. That said, compatibility issues are becoming less common every year as more software stacks adopt modern OpenSSH and modern cryptographic libraries.

Real-Life Example

A typical modern example is a software engineer generating a personal SSH key for GitHub, GitLab or a production bastion host. In that situation, ssh-keygen -t ed25519 is usually the right choice because it is secure, fast and easy to manage. Teams also like it for automation because it reduces operational friction without weakening authentication.

Side-by-Side Comparison

AlgorithmSecurityPerformanceKey SizeCompatibilityRecommended For
RSAStrong at 3072+ bits (SHA-2)Slow keygen and signingLargeExcellentLegacy systems and maximum compatibility 
DSAWeak (1024-bit, ~80-bit security)Slow, nonce-dependentModerateDisabled in OpenSSH 7.0+Only old systems that cannot be changed 
ECDSAStrong (nonce-sensitive)FastSmallGoodConstrained environments or existing ECDSA deployments 
EdDSA / Ed25519Very strong (~128-bit, deterministic)Very fastVery smallStrong in modern toolingNew SSH setups and general-purpose use 

Which One Should You Choose?

Picking an SSH key algorithm is rarely a one-size-fits-all decision. The right choice depends on what you are protecting, what your existing infrastructure supports and how much operational change you are willing to absorb in the short term. The sections below break the decision down by scenario — new deployments, legacy compatibility, special cases and a practical migration strategy, so you can match your environment to the algorithm that fits it best.

For New Systems

For new SSH keys, choose Ed25519. It is the best balance of security, performance and simplicity and it is the default recommendation in most modern SSH guidance. If there is no special legacy constraint, Ed25519 should be your first choice.

For Legacy Compatibility

Choose RSA when you need to connect to older servers, appliances or software that cannot handle Ed25519. In those environments, RSA remains the safest compatibility bridge, especially when using a modern SHA-2 signature method rather than the older SHA-1-based ssh-rsa variant.

For Special Cases

Use ECDSA only when you specifically need an elliptic-curve option and know your environment supports it well. Avoid DSA entirely for new work and treat it as a migration problem rather than a design choice.

Practical Migration Strategy

If your organization still has mixed SSH key types, a sensible migration path is to run both RSA and Ed25519 during transition. Keep RSA only for systems that cannot yet support Ed25519 and gradually phase it out as those systems are upgraded. This avoids downtime while still moving the environment toward modern cryptography.

A practical rollout might look like this:

  1. Generate a new Ed25519 key for your primary SSH identity.
  2. Keep an RSA key only for old systems that still require it.
  3. Add both public keys to authorized_keys where necessary.
  4. Monitor which keys are still being used.
  5. Remove RSA once compatibility is no longer needed.

Post-Quantum Considerations

It is worth noting that all four SSH key algorithms discussed in this blog — RSA, DSA, ECDSA and EdDSA are vulnerable to attacks from sufficiently powerful quantum computers. Shor’s algorithm, if implemented on a large-scale quantum computer, could break both integer factorization (RSA, DSA) and elliptic curve discrete logarithm (ECDSA, EdDSA) problems in polynomial time. While such quantum computers do not yet exist organizations with long-term secrecy requirements should begin planning for post-quantum cryptography (PQC).

NIST has been standardizing post-quantum cryptographic algorithms and the OpenSSH project has already begun experimenting with hybrid key exchange methods that combine classical algorithms with post-quantum candidates. OpenSSH 9.0 introduced a hybrid Streamlined NTRU Prime + X25519 key exchange as the default, which protects the session key exchange against future quantum attacks. However, post-quantum SSH authentication keys are still in early development. For now, using Ed25519 for authentication remains the best practical choice, with the understanding that a transition to post-quantum signatures will eventually be necessary.

Post-Quantum Key Exchange (KEX) in SSH

While post-quantum authentication is still maturing, post-quantum key exchange has already reached production. In April 2025, OpenSSH 10.0 was released with a hybrid post-quantum key exchange, mlkem768x25519-sha256, enabled by default. This combines the classical X25519 Diffie-Hellman exchange with ML-KEM-768, the NIST-standardized post-quantum key encapsulation mechanism based on CRYSTALS-Kyber (FIPS 203). The hybrid construction provides defense in depth: the session key is derived from both components, so the exchange remains secure as long as either algorithm holds — a sensible insurance policy while the cryptographic community builds confidence in post-quantum primitives.

This matters specifically because of harvest-now, decrypt-later attacks: adversaries capable of recording today’s encrypted SSH sessions could, once a cryptographically relevant quantum computer exists, retroactively decrypt them. The key exchange handshake is the pivot point for that entire session’s confidentiality, so upgrading it is the most urgent post-quantum step. If your organization operates OpenSSH 10.0 or later, mlkem768x25519-sha256 is already protecting you. On earlier versions (9.0 through 9.9), the older sntrup761x25519-sha512 hybrid is available and should be preferred over pure classical key exchange methods for any long-lived sessions or high-sensitivity traffic.

In practical terms, the message is straightforward: Ed25519 remains the right choice today for SSH authentication keys, but pair it with a modern OpenSSH build (10.0+) so that the session key exchange is already quantum-resistant. When NIST-approved post-quantum signature algorithms (ML-DSA / CRYSTALS-Dilithium, FIPS 204) arrive in OpenSSH for authentication, the migration will be incremental rather than disruptive.

Implementation Services for Key Management Solutions

We provide tailored implementation services of data protection solutions that align with your organization's needs.

How Encryption Consulting Can Help?

At Encryption Consulting, we understand the challenges enterprises face in managing SSH keys at scale. Our solution, SSH Secure, is built to deliver end-to-end key lifecycle security, provide and gain comprehensive visibility, ensuring that organizations can manage keys confidently without added complexity. Here’s how we help:

1. Centralized Visibility and Ownership Mapping

Through a combination of agent-based and agentless discovery, SSH Secure locates every SSH key across servers and user machines. All keys are stored in a single inventory with ownership and usage details, eliminating orphaned keys, reducing key sprawl and ensuring full accountability across the environment.

2. Secure Access Control and Enforce Session-Bound Keys

Granular role-based access control (RBAC) ensures that users only receive the minimum level of access required. For sensitive or temporary operations, SSH Secure issues ephemeral session-bound keys that expire automatically. Together, these controls enforce the principle of least privilege and minimize the blast radius of compromised credentials, if any.

3. Automated Key Lifecycle Orchestration

SSH Secure automates the complete key lifecycle, covering secure generation, policy-driven rotation, scheduled expiration and revocation. Lifecycle governance eliminates weak or stale keys, reduces human intervention, and ensures continuous compliance with industry best practices.

4. HSM-Integrated Protection

All private keys are secured within HSMs, ensuring non-exportability and tamper resistance. Keys are generated using strong cryptographic algorithms such as RSA-4096, ECDSA and Ed25519, providing both strong protection and resilience against brute-force attacks and efficiency.

Using HSMs is also highly effective against memory scraping and operating system compromise attacks. Even if malware gains access to the host OS or attempts to read process memory, the private keys remain isolated inside the HSM; they are never exposed to RAM or disk, so attackers cannot extract them from system memory, cache or swap space. This hardware-backed isolation dramatically reduces risk compared to software-only key storage and provides defense even in scenarios of elevated or root-level OS compromise.

5. Policy-Driven Control for Key Operations

All key operations, such as generation, approval workflows, rotation and revocation, are enforced through policy-based controls. This ensures consistency across the environment, reduces manual errors and maintains organization-wide security standards. Policies can be adapted to fit regulatory requirements or customized to support internal governance models.

6. Continuous Monitoring, Auditing and Compliance Readiness

SSH Secure provides real-time monitoring of key activities with detailed event logging and built-in anomaly detection. Logs are integrated with Splunk or Loki-Grafana dashboards for advanced visualization, correlation and alerting. Flexible audit capabilities include downloadable logs and detailed reports, giving security teams clear insights into key usage and overall posture. Centralized auditing with policy-based alerts enables proactive security management, rapid anomaly detection and faster incident response.

Conclusion

SSH key selection is not merely a technical preference; it is a security decision that affects the integrity of remote access, the resilience of automated workflows, and the compliance posture of your organization. Each of the four algorithms discussed in this blog has a distinct profile: RSA offers battle-tested compatibility and remains necessary for legacy environments; DSA is a deprecated algorithm that should be migrated away from as soon as possible; ECDSA provides efficient elliptic curve cryptography but carries implementation complexity and lingering concerns about NIST curve provenance; and Ed25519 delivers the strongest combination of security, performance, simplicity and modern tooling support.

For the vast majority of new SSH deployments, Ed25519 is the clear recommendation. It eliminates entire categories of implementation vulnerabilities through deterministic nonce generation, offers the smallest key sizes of any mainstream algorithm, runs in constant time to resist side-channel attacks and is the default in modern OpenSSH. Organizations that still rely on RSA should ensure they are using 4096-bit keys with SHA-2 signatures and should plan a migration timeline toward Ed25519. Any remaining DSA keys should be treated as a priority remediation item.

Looking ahead, the cryptographic landscape will continue to evolve. Post-quantum cryptography is on the horizon and SSH implementations are already beginning to incorporate hybrid key exchange mechanisms. However, the fundamentals of good key management, using strong algorithms, rotating keys regularly, enforcing least-privilege access, auditing key usage and maintaining a clear inventory of all SSH credentials will remain essential regardless of which algorithms the future brings. By choosing Ed25519 today and maintaining a disciplined approach to SSH key lifecycle management, you position your infrastructure for both current security and a smoother transition to whatever comes next.