CentOS下GPG密钥生成失败遇到的两个问题和解决方法

2021-07-04  本文已影响0人  testerzhang

1. 问题一

想生成GPG密钥,结果还没生成,就自动退出了。


$ gpg --gen-key

中间省略输入的内容,到了下面这句话,还没输入密钥就报错了

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.

gpg: cancelled by user
gpg: Key generation canceled.

解决方案:

$ script /dev/null
$ gpg2 --gen-key

然后就会弹出


image.png

可以输入密码了。

ssh 的时候直接对应的用户名登录,不要用su命令切换用户。

2. 问题二

image.png

卡在这里了,里面的英文是这样的:


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.

解决方案:

这时候在终端通过打字和移动鼠标很难满足。

解决办法是安装 rng-tools 这个工具,

# yum install rng-tools
# rngd -r /dev/urandom

Initalizing available sources

Initalizing entropy source Hardware RNG Device

Enabling RDSEED rng support

Initalizing entropy source Intel RDRAND Instruction RNG

Enabling JITTER rng support

Initalizing entropy source JITTER Entropy generator

这时候我们可以看到卡住的session已经自动生成session了。

     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.
gpg: /home/testerzhang/.gnupg/trustdb.gpg: trustdb created
gpg: key xxxxx marked as ultimately trusted
public and secret key created and signed.

欢迎关注我的公众号testerzhang,原创技术文章第一时间推送。

上一篇 下一篇

猜你喜欢

热点阅读