Wednesday, May 1, 2013

Using GPG on linux

Creating a new private and public key

#gpg --gen-key

On Red Hat 6 , it will require to have full access to the terminal that your using. You can avoid that generating a key in batch mode.

 #cat file.txt
%echo Generating a default key
Key-Type: default
Subkey-Type: default
Name-Real: Name
Name-Comment: Comments
Name-Email: email
Expire-Date: 0
Passphrase: changeme
# Do a commit here, so that we can later print "done" :-)
%commit
%echo done

#gpg --gen-key --batch file.txt

After all this, server normally requires some entropy to generate the key, so you can avoid that using a second terminal an running the following.

 #rngd -r /dev/urandon