An RSA or DSA key pair generator is set to fewer than 2048 bits

tx0/kotlin:short-rsa-keyrecommendedwarningsecurity/cryptodepth fastsecurity, cwe-326

What it finds

generator.initialize(1024) for RSA or DSA gives keys within reach of current factoring, which standards no longer allow. 2048 bits is the minimum, 3072 for use beyond 2030.

From the rule's source, small_rsa_key.rs.

Example from the rule's tests
import java.security.KeyPairGenerator fun keys() {    val generator = KeyPairGenerator.getInstance("RSA")    generator.initialize(1024)tx0 reports: 1024-bit keys are too short    val strong = KeyPairGenerator.getInstance("RSA")    strong.initialize(4096)    val ec = KeyPairGenerator.getInstance("EC")    ec.initialize(256)}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:short-rsa-key" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:short-rsa-key] reason="..."

tx0 explain tx0/kotlin:short-rsa-key shows the same in the terminal. Found a false positive? Report it.