What RSA key length should I use for my SSL certificates?
As of 2020, RSA keys should be 2048 bits.
1024 bits
- 1024 bits RSA certificates are obsolete and not accepted by browsers.
- Firefox stopped accepting 1024 bits RSA certificates in 2014.
- Certificate authorities stopped delivering 1024 bits RSA certificates in 2014 or before. See GlobalSign or Comodo notice.
- 1024 bits keys were deprecated because they could be cracked given a small datacenter (thousands of CPU or hundreds of GPU, in maybe a few months). It may seem a lot but it was well within reach of any large organization or government.
2048 bits
- 2048 bits RSA certificates are currently the accepted norm in use.
- Default baseline delivered by CA and used by software.
- Will eventually be cracked too. Don't know when but could take decades.
- Doubling the size takes many many orders of magnitude more compute power to crack. See question how much stronger is RSA 2048 compared to 1024.
3072 bits
- For security beyond 2030, 3072-bit RSA keys are recommended.
- NIST assigns an "effective strength" of 128 bits to 3072-bit RSA keys, versus 112 bits for 2048 bit keys. This means that it would take about 216 more computational effort to crack such a key.
- As of 2022, less than 10% of surveyed sites use 3072-bit keys, while 85% still use 2048-bit keys.
- For their extended validation services, some CAs don't allow 2048-bit keys and require at least 3072-bit keys.
- Let's Encrypt will issue certificates for 3072-bit keys. It has been proposed as the default RSA key size, but opposition has ranged from "2048 bits is good enough," to "might as well go to 4096 bits."
4096 bits
- While it's an oddball size, 4096-bit keys are available and widely supported. All major CAs can issue certificates for 4096-bit RSA.
- The effective strength of 4096-bit keys has not been estimated by NIST, but others suggest a value of 140, which is only 4000 times stronger than 3072-bit keys and sometimes regarded as "not worth it."
- Computational cost is not linear with key size. 4096 is not twice as slow as 2048, it is maybe 10 times slower to process. Do not blindly upgrade certificates to 4096 bits without considering the performance impact.
- The "web" is largely remaining on 2048 bits certificates because it cannot bear the hardware cost for 4096 bits. Consider large actors like Google, CloudFlare, NetFlix with immense traffic and hardware footprint.
- Fewer sites use RSA 4096-bit keys than 3072-bit keys, but usage is comparable.
Extra
- Beyond 3072 bits, NIST recommends 7680 and 15360 bits, with effective security strength of 192 and 256 bits, respectively. However, support for these large keys is rare in software and with CAs.
- RSA was first publicly described in 1977 and it's still strong almost 50 years later. Just have to increase the number of bits to keep up with faster computers.
- There is another method for public key cryptography based on elliptic curves, see ECDSA (1992).
- There is a huge disconnect between the capacity of a user and of an attacker. A web server or a mobile client have one (low-power) CPU. An attacker can have a whole datacenter, for reference a newly built AWS datacenter is hosting about 60 000 servers.
- It is incredible that a single mobile device can compute some maths over a few seconds... that millions of computers couldn't dream to guess in a lifetime.
This coming August, Microsoft is going to deploy a patch to Server 2003/2008, Win7 ect.. that will require the use of a minimum 1024 bit RSA key. So you might as well start making that your "bare minimum" standard.
Certificate authorities will not sign csrs less than 2048 bits in size so you should generate your csr to be 2048 bits.
As many customers require compliance with NIST cryptographic standards, I use the guidance in the NIST Special Publication 800‑57, Recommendation for Key Management Part 1, §5.6. Most of our applications are a good fit for 112 "bits" of security, so that corresponds to triple-DES (or a small bump up to 128-bit AES) for symmetric ciphers and a 2048-bit key for RSA. See Table 2 for a rough equivalence.
Valid or not, being able to refer them to a NIST publication helps customers feel better about security (if they bother to ask).