
首先,我花了一個小時嘗試類似標題的答案,因此請在將此問題標記為重複之前仔細閱讀此內容。
我使用 YubiKey 透過其智慧卡功能來儲存我的 PGP 私鑰。
我確認私鑰有效,因為我可以使用 SSH 連接到伺服器(會觸發pinentry-mac
)。
$ cat .gnupg/gpg-agent.conf
enable-ssh-support
default-cache-ttl-ssh 60
max-cache-ttl-ssh 120
default-cache-ttl 60
max-cache-ttl 120
pinentry-program /usr/local/bin/pinentry-mac
gpg: decryption failed: No secret key
當 YubiKey 智慧卡未解鎖並且我運行命令時,會引發該錯誤gpg
。
$ gpg --decrypt /path/to/file.asc
gpg: encrypted with RSA key, ID redacted
gpg: encrypted with 4096-bit RSA key, ID redacted, created redacted
redacted
gpg: public key decryption failed: Broken pipe
gpg: decryption failed: No secret key
當拋出上述錯誤時,使用 SSH 連接到伺服器會觸發pinentry-mac
,然後ctrl+c
運行gpg --decrypt /path/to/file.asc
並被pinentry-mac
觸發。
這裡發生了什麼事?我怎樣才能gpg --decrypt /path/to/file.asc
在不先使用的情況下開始工作ssh
?
我可能錯過了一些東西!
答案1
將GnuPG從版本升級2.2.22
到2.2.23
使用brew upgrade
解決了問題。