我的 SSL 证书应该使用什么 RSA 密钥长度?

我正在创建一个 CSR 的过程中,我想知道哪一个可以说是我的 RSA 密钥的最佳长度。

当然,384可能太弱,16384可能太慢。

对于应该使用的密钥长度是否有共识,这取决于证书的生命周期?

编辑: 像大多数人一样,我希望我的钥匙相当坚固。我不担心国安局会在2019年弄坏我的钥匙。我只是想知道什么是最好的做法时,一个计划做正常的业务(例如一个电子商务网站)

96224 次浏览

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).

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.

For SSL certificates used on websites, this text from the Thawte.com website (as at 2014-07-22) is important to note:

Industry standards set by the Certification Authority/Browser (CA/B) Forum require that certificates issued after January 1, 2014 MUST be at least 2048-bit key length.

I think 4096 is ok for RSA

Check This link

The end of the SHA-1 signature is nothing new, but Google has accelerated the process of the chrome. In the next few weeks, you should check their SSL certificates.

This may be helpful

I needed to create several new SSL certs and was not satisfied with the answers above because they seemed vague or out dated so I did a little digging. Bottom line the selected answer is correct use "2048-bit keys... longer is meaningless".

Increasing the bit length to 4096 adds a potentially meaningful load to your server (depending on your existing load) while offering basically an insignificant security upgrade

If you are in a situation where you need longer than a 2048 bit key you don't need a longer bit length, you need a new algorithm