Encryption

RSA vs ECC: Choosing the Right Public Key Algorithm

RSA and ECC both power public key cryptography, but TLS 1.3 has already chosen. Learn the key-size tradeoffs, performance differences, and what to deploy.

Editorial Team ·
9 min read intermediate

Introduction

The NSA gave federal agencies until 2030 to replace RSA with quantum-safe algorithms. But the choice between RSA and ECC matters right now, because TLS 1.3 has already made it for you.

RSA vs ECC is the central decision in public key cryptography — for TLS certificates, SSH keys, code signing, and any system where you need to exchange keys or prove identity without a shared secret. These two algorithms have dominated the field for decades. They are now converging on a single verdict: ECC is the correct choice for new deployments, and RSA-2048 has a hard expiry date of approximately 2030.

TLS 1.3 (RFC 8446, 2018) removed RSA key exchange entirely. The only key agreement mechanism in TLS 1.3 is ECDHE — Elliptic Curve Diffie-Hellman Ephemeral. Every TLS 1.3 connection uses elliptic curve mathematics to establish a session key. RSA certificates are still used for server authentication in TLS 1.3, but the key exchange step that creates the session key is pure ECC.

NIST SP 800-57 Part 1 (2020) makes the key-size comparison definitive: a 256-bit ECC key (P-256) provides 128-bit security — the same security level as RSA-3072. ECC achieves equivalent protection with a key 12 times smaller. The performance difference is even more stark: RSA-2048 key generation takes approximately 500ms in software; ECC P-256 takes under 1ms.

Understanding why this gap exists — and where RSA is still legitimately in use — is the foundation for making good deployment decisions today.

What Is RSA?

RSA (Rivest-Shamir-Adleman, 1977) is a public key cryptosystem based on the mathematical difficulty of factoring the product of two large prime numbers. Its security relies on the fact that multiplying primes is fast, but reversing the operation — finding the original primes from their product — is computationally infeasible for large numbers.

An RSA key pair consists of a public key (your modulus and public exponent, shareable freely) and a private key (your modulus and private exponent, kept secret). Data encrypted with the public key can only be decrypted with the private key, and vice versa.

RSA is used for encryption, digital signatures, and historically for key exchange (RSA key exchange is now removed from TLS 1.3 due to its lack of forward secrecy).

What Is ECC?

ECC (Elliptic Curve Cryptography) is based on the mathematics of elliptic curves over finite fields. An elliptic curve is defined by an equation of the form y² = x³ + ax + b. For cryptographic use, computations happen modulo a large prime, creating a finite field.

The security relies on the Elliptic Curve Discrete Logarithm Problem (ECDLP): given a base point G and a public key Q = k × G (where k is the private key and × denotes point multiplication on the curve), it is computationally infeasible to recover k. Point multiplication is easy to compute forward; reversing it is hard.

ECC supports the same operations as RSA — key exchange (ECDH), digital signatures (ECDSA), and increasingly hybrid authentication — but with much smaller keys.

How RSA and ECC Work Differently

The core performance difference comes from the key sizes required for equivalent security. NIST SP 800-57 defines security levels based on the number of bits an attacker needs to try:

128-bit security (recommended for new deployments) requires:

  • RSA: a 3,072-bit key
  • ECC: a 256-bit key (NIST P-256)

RSA private key operations involve modular exponentiation with 3,072-bit numbers. ECC operations involve point multiplication on a curve defined over 256-bit numbers. The arithmetic is fundamentally smaller, which is why ECC is faster in most operations and produces smaller output.

One area where RSA is faster: signature verification. RSA verification uses the public exponent (typically 65537), which makes it extremely fast. ECC verification requires a full point multiplication, which is slower than RSA verification — though still sub-millisecond in practice.

This video demonstrates how elliptic curve mathematics generates smaller, equally strong keys compared to RSA's large primes. The key-size comparison table above shows the exact security equivalence between them.

RSA vs ECC

The key size column is the most important — a 256-bit ECC key delivers the same 128-bit security as a 3,072-bit RSA key. Note that TLS 1.3 removed RSA key exchange while retaining ECDHE.
FeatureRSAECC
Security basisInteger factorizationElliptic curve discrete log
Key size for 128-bit security3,072-bit256-bit (P-256)
Key generation speedSlow (~500ms for RSA-2048)Fast (<1ms for P-256)
Signature sizeLarge (256–512 bytes)Small (64 bytes for P-256)
Quantum vulnerabilityYes (Shor’s algorithm)Yes (Shor’s algorithm)
TLS 1.3 key exchangeRemovedRequired (ECDHE only)
TLS 1.3 authenticationSupported (RSA certificates)Supported (ECDSA certificates)
Current NIST guidanceMinimum 3072-bit; plan migrationP-256+ recommended for new use

The most consequential row is TLS 1.3 key exchange. TLS 1.3 removed RSA key exchange entirely because RSA key exchange lacks forward secrecy — if an attacker records a TLS session and later obtains the server’s RSA private key, they can decrypt the recording. ECDHE generates a fresh ephemeral key pair per session, so past sessions remain protected even if the server key is later compromised.

Real-World Use Cases

TLS certificates for web servers: Both RSA and ECDSA certificates work in TLS 1.3. ECDSA certificates (P-256) are smaller and faster to sign. Let’s Encrypt issues both; ECDSA is increasingly the default. For maximum compatibility with older clients (Android 4.x, Java 7, Windows XP), RSA-2048 certificates remain the safe fallback — but modern clients all support ECDSA.

SSH authentication: Ed25519 (EdDSA on Curve25519) is the modern standard for SSH keys, approved in NIST FIPS 186-5. Ed25519 keys are 32 bytes, generate in under 1ms, and are constant-time by design (immune to timing side channels). If your server allows both RSA-4096 and Ed25519 SSH keys, new users should generate Ed25519. Migrate RSA keys during routine credential rotation.

Code signing: Certificates used to sign software, firmware, and app packages must remain valid for the lifetime of the signed artifact. For long-lived signatures (device firmware, OS components), ECDSA P-384 provides higher security margin than P-256. NSA CNSA 2.0 recommends P-384 for national security applications that cannot yet use PQC.

Common Mistakes to Avoid

Using RSA-1024 anywhere. NIST disallowed RSA-1024 for all cryptographic purposes in 2013. It can be factored with academic-scale computing resources. Any system still generating or accepting RSA-1024 keys has a critical vulnerability that must be addressed immediately.

Assuming ECDSA and RSA certificates work identically in TLS 1.3. Both RSA and ECDSA certificates authenticate the server in TLS 1.3. The difference is the key exchange: TLS 1.3 always uses ECDHE for key exchange regardless of certificate type. An RSA certificate in TLS 1.3 authenticates the server, but the session key comes from ECDHE — so forward secrecy is always present in TLS 1.3 regardless of certificate algorithm.

Believing ECC is quantum-safe. Both RSA and ECC are broken by Shor’s algorithm on a quantum computer. Neither is quantum-safe. The advantage of migrating from RSA to ECC today is performance and key size, not quantum resistance. Post-quantum resistance requires ML-KEM and ML-DSA, which are separate from both RSA and ECC.

Confusing ECDH and ECDSA. ECDH (and its ephemeral variant ECDHE) is for key agreement — generating a shared secret between two parties. ECDSA is for digital signatures — proving that a message was signed by the holder of a private key. TLS 1.3 uses ECDHE for key exchange and either RSA or ECDSA for server authentication. These are different operations.

Getting Started

Audit your current certificate and key inventory before making any changes. Check every TLS certificate for its key type and size — RSA-2048 is adequate today but should be migrated to RSA-3072 or ECDSA P-256 at next renewal. RSA-1024 certificates must be replaced immediately. Review SSH authorized keys files on your servers for RSA-1024 or DSA keys; both are disallowed.

For new TLS certificates, request ECDSA P-256 (or P-384 for higher-risk applications). All major CAs including Let’s Encrypt, DigiCert, and Comodo issue ECDSA certificates. Your web server needs to be configured to serve the ECDSA certificate — most modern servers handle this automatically via SNI.

For SSH, generate Ed25519 keys for any new deployment. On systems managing sensitive infrastructure, consider hardware-backed keys using a FIDO2 hardware token or HSM — the private key never leaves the hardware.

Monitor NIST’s PQC standardization progress and your TLS library’s support. OpenSSL 3.2+ and BoringSSL already support hybrid ECDHE+ML-KEM key exchange. Enabling it in your load balancer now protects future-sensitive traffic against HNDL attacks at zero cost to current users.

To understand why both RSA and ECC will eventually require replacement, read post-quantum cryptography: NIST standards explained. To see how TLS 1.3 already uses ECC for every session, read TLS 1.3 vs TLS 1.2.

FAQ

Common questions — answered in plain English.

What is the difference between RSA and ECC?
RSA (Rivest-Shamir-Adleman) relies on the difficulty of factoring large integers. ECC (Elliptic Curve Cryptography) relies on the difficulty of solving the elliptic curve discrete logarithm problem. Both provide equivalent security at different key sizes — a 256-bit ECC key provides the same 128-bit security as a 3072-bit RSA key, making ECC significantly more efficient.
Is ECC better than RSA?
For most new deployments, yes. ECC provides equivalent security with much smaller keys, faster key generation, and smaller signatures. TLS 1.3 uses ECDHE (elliptic curve Diffie-Hellman) as its only key exchange mechanism. NIST recommends ECC P-256 or P-384 for new deployments. RSA remains acceptable at 3072 bits or above through approximately 2030, but ECC is the forward-looking choice.
Why is ECC faster than RSA?
ECC operations work on points on an elliptic curve over a finite field, which can be computed efficiently with smaller numbers. RSA requires arithmetic with very large integers — RSA-3072 uses 3,072-bit numbers while ECC P-256 uses 256-bit numbers. The key generation step is where the difference is most dramatic: RSA-2048 key generation takes roughly 500ms in software; ECC P-256 takes under 1ms.
What key size should I use for RSA?
NIST recommends RSA-3072 as the minimum for new applications requiring 128-bit security beyond 2030. RSA-2048 provides only 112-bit security and is acceptable only through approximately 2030 per NIST SP 800-57. RSA-1024 is disallowed by NIST since 2013 and must never be used. For new deployments, ECC P-256 achieves the same 128-bit security with a 256-bit key.
Is RSA still secure in 2024?
RSA-2048 and RSA-3072 are computationally secure against classical computers in 2024. The concern is forward-looking: Shor's algorithm on a quantum computer would break RSA by factoring its large prime product. NSA's CNSA 2.0 advisory requires national security systems to plan migration away from RSA now, with PQC alternatives in place by 2030.
Does ECC protect against quantum computers?
No. Both RSA and ECC are vulnerable to Shor's algorithm on a quantum computer. Shor's solves integer factoring (breaking RSA) and the discrete logarithm problem (breaking ECC). Neither algorithm is quantum-safe. Both must eventually be replaced by post-quantum algorithms like ML-KEM and ML-DSA when cryptographically relevant quantum computers emerge.

References

  1. [1]
  2. [2]
  3. [3]
  4. [4]
  5. [5]