SSL_R_WRONG_RSA_KEY_SIZE security config_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
92%Fix Rate
84%Confidence
1Evidence
2023-07-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
OpenSSL 1.1.1 active
OpenSSL 3.0 active
Java 8 active
Java 11 active
Nginx 1.20 active

Root Cause

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

generic

中文

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

Official Documentation

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

Workarounds

  1. 95% success Generate a new RSA key with 2048 or 4096 bits. OpenSSL: `openssl genrsa -out newkey.pem 2048` then reissue the certificate.
    Generate a new RSA key with 2048 or 4096 bits. OpenSSL: `openssl genrsa -out newkey.pem 2048` then reissue the certificate.
  2. 30% success If you control the client, configure it to allow 1024-bit keys only for testing, e.g., Java: `-Djava.security.properties=...` to relax policy, but avoid in production.
    If you control the client, configure it to allow 1024-bit keys only for testing, e.g., Java: `-Djava.security.properties=...` to relax policy, but avoid in production.
  3. 85% success Use ECDSA keys (e.g., P-256) instead, which provide equivalent security with smaller key sizes: `openssl ecparam -genkey -name prime256v1 -out eckey.pem`.
    Use ECDSA keys (e.g., P-256) instead, which provide equivalent security with smaller key sizes: `openssl ecparam -genkey -name prime256v1 -out eckey.pem`.

中文步骤

  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`。

Dead Ends

Common approaches that don't work:

  1. 80% fail

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

  2. 60% fail

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

  3. 50% fail

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