ASVS 5.0 V11.6.1 (Level 2) requires approved algorithms and modes for key generation, seeding, and digital signature creation and verification. Key generation must not produce keys that fall to known attacks, such as RSA keys that Fermat factorization can break.
Why it matters
A key pair is only as strong as its generator. Weak randomness, hand rolled prime selection or primes that sit too close together give an attacker the private key from the public one. Signatures with weak parameters fail the same way.
How to implement it
Never write your own generator. Use a vetted library or your KMS, and pick modern algorithms:
openssl genpkey -algorithm ED25519 -out sign.pem
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:3072 -out rsa.pem
Use Ed25519 or ECDSA P-256 for signatures where you can; RSA with PSS padding where compatibility demands it. Generate production keys inside a KMS or HSM so the private half never exists in app memory.
How to test it
Check each public key in your inventory: algorithm, size and, for RSA, public exponent (65537 is standard). Run a public key checker over certificates you issue. Review code for any custom prime or key generation, which should be zero.
Common mistakes
- Generating keys with a seeded non secure random generator
- Using a tiny public exponent
- Reusing one key pair for signing and encryption
Quick check
Who should generate production keys?
A vetted library, preferably a KMS or HSM, never custom code.