One of the ways that RSA keys get consistently owned is when they're generated without enough entropy. Dan Kaminsky refers to a study which found that 1 in 200 RSA keys were badly generated and these were the ones that were found, not to mention the millions of others that were not found.
Thus, a good, properly seeded RNG is needed during RSA keypair generation for GPG, SSL, SSH, etc. wherever RSA key generation happens.
Phuctor is an online tool which searches for PGP RSA key pairs and factors them. Surprisingly, they even factored a 4096bit RSA key in the strong set which was badly generated with the first factor being the number 231 (3 * 77). (According to Polynomial, they only factored a corrupt subkey, which should have no real-world impact.)
When I'm generating RSA public/private keypairs for SSL, SSH, GPG, etc., is there an offline tool I can use to determine how hard and how large the primes are? Can I estimate the computational difficulty in factoring this given RSA key pair so I can determine whether they were generated properly?
Obviously, I use a secure desktop computer for key-pair generation (and optionally /dev/random
), as Linux's RNG is seeded by "mouse and keyboard activity, disk I/O operations, and specific interrupts"(source, PDF) which virtual machines often don't have. While this should be enough, I like to understand the underlying methods and would like to test my key pairs to ensure security.