Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to generate gpg keys in linux [closed]

I'm not able to generate GPG keys in linux

sudo gpg --gen-key      # This is the command to try to generate key

error

You need a Passphrase to protect your secret key.

gpg: problem with the agent: Timeout        
gpg: Key generation canceled.

Please let me know where I'm doing wrong

like image 744
user2932003 Avatar asked Mar 02 '15 04:03

user2932003


People also ask

How can I get GPG public key in Linux?

Open TerminalTerminalGit Bash. Use the gpg --list-secret-keys --keyid-format=long command to list the long form of the GPG keys for which you have both a public and private key.


1 Answers

Please check with this

1) Run the gpg-agent command:

gpg-agent --daemon --use-standard-socket --pinentry-program /usr/bin/pinentry-curses

2) Generate enough entropy

sudo rngd -r /dev/urandom

3) Finally run the gpg command to generate the key:

gpg --gen-key

please run all commands with non-root user only

Please login with same user,which is used to create gpg keys.

1.We will export both our public key and private key as follows:

  user$ gpg --export -a -o mypublickey.txt [email protected]
  user$ gpg --export-secret-key -a -o myprivatekey.txt [email protected]
  user$ ls my*

myprivatekey.txt mypublickey.txt

  1. Import keys with same user

    User$ gpg --import myprivatekey.txt
    
  2. now try decrypt with same user

like image 55
Rupesh Avatar answered Oct 05 '22 22:10

Rupesh