在运行 gpg --gen-key 生成密钥时,按提示输入了完整的信息之后,一直卡住没成功,屏幕提示:
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 这个工具,apt-get install rng-tools 或 yum install rng-tools 即可完成安装。
之后再执行命令:rngd -r /dev/urandom,生成密钥就能瞬间完成了。