GPG 沒有足夠的熵

GPG 沒有足夠的熵

我在後台運行了大量進程來嘗試獲得足夠的熵,但我仍然失敗。

**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.
Not enough random bytes available.  Please do some other work to give
the OS a chance to collect more entropy! (Need 210 more bytes)**

我需要一種方法來產生有效的金鑰,因為我想做的事情顯然失敗了。

答案1

你看過RNG嗎?

Fedora/Rh/Centos 類型:sudo yum install rng-tools

在 deb 類型上:sudo apt-get install rng-tools進行設定。

sudo rngd -r /dev/urandom然後在生成密鑰之前運行。

參考:http://it.toolbox.com/blogs/lim/how-to-generate-enough-entropy-for-gpg-key- Generation-process-on-fedora-linux-38022

答案2

我能夠透過以下方式產生密鑰

apt-get install rng-tools

在另一個 SSH 視窗中打開

 gpg --gen-key

返回您的第一個 SSH 會話並運行

sudo rngd -r /dev/urandom

讓它運行直到 gpg 產生你的密鑰!

答案3

若要檢查目前可用的熵位元組數,請使用

cat /proc/sys/kernel/random/entropy_avail

熵桶有 4096 位元組大,很快就會耗盡。

使用這個小型「讀取速度」工具(http://1wt.eu/tools/readspeed/),可以用不同的方法測量熵桶填充的速度。

例如,啟動:

$ ./readspeed < /dev/random

並移動滑鼠。你會看到「readspeed」一旦充滿熵桶就會清空它,當你移動滑鼠時,它會填滿一點。

嘗試不同的方法後,似乎鍵盤輸入和滑鼠移動是補充該水桶最有效的方法。網路傳輸和硬碟複製沒有太大影響。

最後,還有一些可用的熵生成設備,例如:http://www.entropykey.co.uk/

答案4

我決心在我的無頭 Ubuntu 14.04 伺服器上產生熵,以便產生 4096 金鑰gpg --gen-key

有一個用於產生熵的包,稱為haveged。安裝範例:

sudo apt-get install haveged

我必須這樣做,sudo apt-get install rng-tools因為它是以下測試中的依賴項。

測試熵是否由 hasged 產生的測試範例:

cat /dev/random | rngtest -c 1000

在任何隨機數產生器中,極少量的失敗都是可以接受的,但在使用懸停時,您可以經常看到 998-1000 次成功。

我在這裡的教程中發現了它:

https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged

跑步後我現在有了鑰匙gpg --gen-key

相關內容