当我运行gpg2时,每次使用它时都会被提示输入密码。根据我对gpg-agent手册页的阅读,应该只在第一次提示我。
gpg-agent is a daemon to manage secret (private)
keys independently from any proto-col. It is
used as a backend for gpg and gpgsm as well as
for a couple of other utilities.
The agent is automatically started on demand
by gpg, gpgsm, gpgconf, or gpg-connect-agent.
Thus there is no reason to start it manually.
...
--default-cache-ttl n
Set the time a cache entry is valid to n
seconds. The default is 600 sec- onds.
Each time a cache entry is accessed, the
entry's timer is reset. To set an entry's
maximum lifetime, use max-cache-ttl.
--max-cache-ttl n
Set the maximum time a cache entry is valid
to n seconds. After this time a cache
entry will be expired even if it has been
accessed recently or has been set using
gpg-preset-passphrase. The default is 2
hours (7200 seconds).如果我正确地读取了它,调用gpg2应该在我第一次使用它时提示输入密码,那么,如果我在接下来的600秒内再次运行它,我将不会再次被提示。正在运行
gpg2 --export-secret-keys --armor john.doe@example.com > /dev/null给我这个:
┌─┐
│ Please enter the passphrase to export the OpenPGP secret key: │
│ "John Doe (asdf) " │
│ 2048-bit RSA key, ID EB7B49EAD38DE665, │
│ created 2018-10-09. │
│ │
│ │
│ Passphrase: _ │
│ │
│ │
└─┘一个快速的ps aux显示gpg-agent正在运行:
ps aux | grep gpg-agent
jdoe 14089 0.1 0.1 100884 3588 ? SLs 18:50 0:07 /usr/bin/gpg-agent --supervised唉,再次运行gpg2 --export-secret-keys...将提示我再次输入密码。
还有几个细节:
pinentry-curses.bashrc中输出了D15gpg2 --version -> gpg (GnuPG) 2.2.4发布于 2018-10-10 06:50:45
来自GnuPG 2.2.4手册,关于--export-secret-keys (特别是):
GnuPG可能要求您输入密码作为密钥。这是必需的,因为秘密密钥的内部保护方法不同于OpenPGP协议指定的方法。
https://unix.stackexchange.com/questions/474385
复制相似问题