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.
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.
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.
| Feature | RSA | ECC |
|---|---|---|
| Security basis | Integer factorization | Elliptic curve discrete log |
| Key size for 128-bit security | 3,072-bit | 256-bit (P-256) |
| Key generation speed | Slow (~500ms for RSA-2048) | Fast (<1ms for P-256) |
| Signature size | Large (256–512 bytes) | Small (64 bytes for P-256) |
| Quantum vulnerability | Yes (Shor’s algorithm) | Yes (Shor’s algorithm) |
| TLS 1.3 key exchange | Removed | Required (ECDHE only) |
| TLS 1.3 authentication | Supported (RSA certificates) | Supported (ECDSA certificates) |
| Current NIST guidance | Minimum 3072-bit; plan migration | P-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?
Is ECC better than RSA?
Why is ECC faster than RSA?
What key size should I use for RSA?
Is RSA still secure in 2024?
Does ECC protect against quantum computers?
References
- [1]
- [2]
- [3]
- [4]
- [5]