GPG key pairs and broken random number generation


Generate a gpg keypair
====$ gpg –gen-key====

Then you’ll need to enter you name, email, and a comment.

If you get to the random number generation and it just dies there, hit ctrl-c

Check /dev/random to make sure you’re getting some output. If you dont get any standard output when you run this, ctrl-c and you will see 0+1 records in/out. This means there is a problem with your /dev/random device.
====$ dd if=/dev/random====

My fix for this was to use urandom in place of a hardware random device. /dev/hw_random does not exist, so I just went with pseudo random instead. To do this, you’ll need the rng-utils package installed. After doing this, test again with dd to make sure you get garbage sent to standard output then go back and retry creating the keys. You should have no problem getting entropy…

$ sudo /sbin/rngd -r /dev/urandom -o /dev/random

Export the public key
====$ gpg –armor –output brokey.gpg –export admica@rootninja.com====

Copy /home/user/.gnupg/brokey.gpg to the bro host and import it.
====$ gpg –import brokey.gpg====


Posted on April 1st, by admica in security.
Comments Off

Comments are closed.