Insufficient cryptographic key size

Insufficient cryptographic key size

Description

Short RSA, DSA or finite-field DH keys may provide too little protection for encryption, signatures or key exchange.

Potential impact

Depending on how the key is used, a compromise can expose encrypted traffic or allow forged signatures.

Remediation

Use at least 2048 bits for RSA and finite-field DH. Choose a larger size when the required strength or protection period calls for it. FIPS 186-5 permits DSA only to verify signatures generated before the standard was implemented.

Examples

Before

c
RSA_generate_key_ex(rsa, 1024, e, NULL);

After

c
RSA_generate_key_ex(rsa, 3072, e, NULL);

The example raises the RSA size from 1024 to 3072 bits. Check that RSA_generate_key_ex returns 1. OpenSSL deprecated this function in 3.0, so use an EVP API such as EVP_RSA_gen for new code.

References