gpg - cannot create key

Latest response

I am trying to use gpg on RedHat 6.3, in order to encrypt / decrypt a file on the command line (ssh'ed into server).

 

I run the "gpg --gen-key" and I step through the menus taking the defaults. It then gets to a point where it says "We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy." it also briefly flashes a message that it can't connect to the agent. At this point the program hangs no matter what I do, and does not generate a key.

 

The same commands work well under RedHat 5.x (which is GNUpg 1.x, I believe).

 

gpg seems completely broken in RedHat 6.x..?

 

Any help would be greatly appreciated.

Responses

Hello Matt,

 

Are you trying to generate the gpg key through ssh ? Have you tried to generate by loging as "root" or normal user directly from virtual console eg: tty1 etc, then try once more to run "gpg --gen-key"

 

Regards

Fábio Da Cunha

I have tried from console / tty1, and from command line accessed via ssh.I tried both root and non-root users. All combinations give the same error.

Try to set  "GPG_TTY=/dev/tty" environment then execute gpg --gen-key command.

 

     [test@example ~]# export GPG_TTY=/dev/tty

 

     [test@example ~]# gpg --gen-key

 

I did a test on my virtual machine logging straight to the console, I noticed that it also took a while to return the shell, seems that it was hanged but in about 1 to 2 minutes it came back with the results. I'm not sure if it took a while due to my virtual machine limitations.

I figured out the issue. I needed to run the following in a second ssh session while generating the new key:

 

rngd -r /dev/urandom -o /dev/random -f -t 1

 

I still get an error message on the screen about not being able to connect to the agent, even after setting the GPG_TTY vaiable.However this doesn't seem to affect the actual functionality of (1) creating a key and (2) encrypting and decrypting files.

 

Thanks for your help.

I hope I understand your issue correctly.

 

Prior to starting the GPG command to create the key, ssh again to your box and su to root and create some disk activity to help with the entropy.

 

# find /var 

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.