I'm in the process of creating a CSR, and I wonder which is arguably the best length for my RSA key.
Of course, 384 is probably too weak, and 16384 is probably too slow.
Is there a consensus on the key length one should use, depending on the certificate lifetime?
Edit :
Like most people, I want my key to be reasonably strong. I'm not concerned that the NSA could maybe break my key in 2019. I just want to know what's the best practice when one plan to do normal business (for example an e-commerce site)
What size RSA key should I use?
Since 2015, NIST recommends a minimum of 2048-bit keys for RSA, an update to the widely-accepted recommendation of a 1024-bit minimum since at least 2002.
Which is better RSA 2048 or 4096?
A 4096 bit key does provide a reasonable increase in strength over a 2048 bit key, and according to the GNFS complexity, encryption strength doesn't drop off after 2048 bits. There's a significant increase in CPU usage for the brief time of handshaking as a result of a 4096 bit key.
Is RSA 2048 enough?
A 2048-bit RSA key provides 112-bit of security. Given that TLS certificates are valid for two years maximum (soon to be decreased to one), 2048-bit RSA key length fulfills the NIST recommendation until late in this decade.
Is RSA 4096 secure?
RSA-4096 is a legitimate encryption cipher. It is one of the best encryption systems that you can use to protect your data in transmission.
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.
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).