SSL certificates

ECDSA vs RSA SSL certificates: which key type should you use?

How ECDSA and RSA certificate keys differ in size, speed and compatibility, how to issue each with Certbot, and how to serve both on Nginx or Apache for maximum compatibility.

AdvancedLinux VPS2 min read

Every SSL/TLS certificate contains a public key, usually either RSA or ECDSA (elliptic curve). Both are secure at recommended sizes, but ECDSA keys are much smaller and faster for the server. This guide compares ECDSA vs RSA certificates and shows how to use them.

Before you start

  • A Linux server with Nginx or Apache and Certbot (or another ACME client).
  • On shared cPanel hosting, AutoSSL chooses the key type; this guide is for servers you manage.

RSA vs ECDSA compared

RSA 2048RSA 3072/4096ECDSA P-256ECDSA P-384
Approx. security level~112-bit~128 / ~140-bit~128-bit~192-bit
Public key size256 bytes384–512 bytes64 bytes96 bytes
Server signing costModerateHighLowLow–moderate
Client compatibilityUniversalUniversalAll modern clientsAll modern clients

In a TLS handshake the server signs with its private key. ECDSA signing is much cheaper than RSA at comparable strength, which helps busy servers, and smaller certificates mean smaller handshakes.

Which should you use?

  • ECDSA P-256 is a strong default for modern websites and APIs.
  • RSA 2048 remains fine and is still needed for some very old clients and embedded devices.
  • Both (dual certificates) gives ECDSA to modern clients and RSA to legacy ones.

Issue certificates with Certbot

  • ECDSA (default in recent Certbot versions):
    sudo certbot certonly --webroot -w /var/www/example.com -d example.com --key-type ecdsa --elliptic-curve secp256r1 --cert-name example.com-ecdsa
  • RSA:
    sudo certbot certonly --webroot -w /var/www/example.com -d example.com --key-type rsa --rsa-key-size 2048 --cert-name example.com-rsa

Check a certificate's key type with openssl x509 -in cert.pem -noout -text | grep 'Public Key Algorithm'.

Serve both on Nginx

ssl_certificate     /etc/letsencrypt/live/example.com-ecdsa/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com-ecdsa/privkey.pem;
ssl_certificate     /etc/letsencrypt/live/example.com-rsa/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com-rsa/privkey.pem;

Nginx picks the certificate matching what each client supports. Include ECDSA cipher suites (ECDHE-ECDSA-...) in ssl_ciphers if you set a custom list.

Serve both on Apache

Add two pairs of SSLCertificateFile and SSLCertificateKeyFile lines in the virtual host – one for each key type. Apache 2.4 with OpenSSL selects the appropriate one per client.

What to check afterwards

  • Force ECDSA: openssl s_client -connect example.com:443 -sigalgs ECDSA+SHA256 – look for the server's certificate key type.
  • Force RSA: repeat with -sigalgs RSA-PSS+SHA256:RSA+SHA256.
  • Confirm both renew: sudo certbot renew --dry-run.

Troubleshooting

  • Old devices fail to connect: they may not support ECDSA – add an RSA certificate.
  • Handshake errors after adding ECDSA: your cipher list contains only ECDHE-RSA suites.
  • Wrong certificate renewed: keep distinct --cert-name values for each key type.

FAQ: ECDSA vs RSA

Is ECDSA more secure than RSA?

At recommended sizes both are secure today. ECDSA gives equivalent security with much smaller keys.

Does key type affect TLS 1.3?

TLS 1.3 works with both; the certificate key type affects only the signature algorithm used for authentication.

What about post-quantum certificates?

Post-quantum key exchange is being deployed in browsers and servers, but publicly trusted post-quantum certificates are not yet standard practice. RSA and ECDSA remain the norm.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.