10

我无法在 linux 中生成 GPG 密钥

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

错误

You need a Passphrase to protect your secret key.

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

请让我知道我在哪里做错了

4

1 回答 1

15

请检查这个

1) 运行 gpg-agent 命令:

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

2)产生足够的熵

sudo rngd -r /dev/urandom

3)最后运行gpg命令生成密钥:

gpg --gen-key

请仅以非 root 用户运行所有命令

请使用相同的用户登录,该用户用于创建 gpg 密钥。

1.我们将导出我们的公钥和私钥,如下所示:

  user$ gpg --export -a -o mypublickey.txt user@replaceurmail.com
  user$ gpg --export-secret-key -a -o myprivatekey.txt user@replaceurmail.com
  user$ ls my*

我的私钥.txt 我的公钥.txt

  1. 导入具有相同用户的密钥

    User$ gpg --import myprivatekey.txt
    
  2. 现在尝试用同一用户解密

于 2015-03-02T04:41:13.727 回答