SSL_R_WRONG_RSA_KEY_SIZE security config_error ai_generated true

RSA 密钥大小 1024 位太小:密钥交换失败

RSA key size 1024 bits is too small: key exchange failed

ID: security/weak-rsa-key-size-rejected

其他格式: JSON · Markdown 中文 · English
92%修复率
84%置信度
1证据数
2023-07-10首次发现

版本兼容性

版本状态引入弃用备注
OpenSSL 1.1.1 active
OpenSSL 3.0 active
Java 8 active
Java 11 active
Nginx 1.20 active

根因分析

RSA 密钥仅为 1024 位,低于建议的最小大小(2048 位),被安全策略拒绝。

English

The RSA key is only 1024 bits, which is below the minimum recommended size (2048 bits) and is rejected by security policies.

generic

官方文档

https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf

解决方案

  1. 生成新的 2048 或 4096 位 RSA 密钥。OpenSSL:`openssl genrsa -out newkey.pem 2048`,然后重新签发证书。
  2. 如果您控制客户端,可以配置其仅用于测试时允许 1024 位密钥,例如 Java:`-Djava.security.properties=...` 放宽策略,但避免在生产环境中使用。
  3. 改用 ECDSA 密钥(例如 P-256),它使用较小的密钥大小提供等效安全性:`openssl ecparam -genkey -name prime256v1 -out eckey.pem`。

无效尝试

常见但无效的做法:

  1. 80% 失败

    Increasing the key size on the server without regenerating the certificate doesn't work; the certificate is separate from the key.

  2. 60% 失败

    Setting the cipher suite to a different RSA variant doesn't change the key size requirement.

  3. 50% 失败

    Disabling the security policy globally is not recommended and often fails due to other compliance checks.