我已將我的 gpg 金鑰從建立它們的電腦匯出到另一台伺服器。
在新伺服器中,我嘗試使用匯入的金鑰來解密我收到的一些文件,但出現以下錯誤:
gpg: encrypted with 1024-bit RSA key, ID 0A83CFB1, created 2014-09-09
"App Eng <[email protected]>"
gpg: public key decryption failed: Bad passphrase
gpg: decryption failed: No secret key
我確信我使用的密碼是正確的。然後我嘗試編輯我的密鑰並更改密碼:
gpg --list-keys
/home/dx/.gnupg/pubring.gpg
-------------------------------
pub 2048R/DB437C11 2016-04-29 [expires: 2018-04-29]
uid [ unknown] App Eng (ibm keys) <[email protected]>
sub 2048R/0AC6B02C 2016-04-29 [expires: 2018-04-29]
pub 1024R/AADE6532 2014-09-09
uid [ unknown] App Eng <[email protected]>
sub 1024R/0A83CFB1 2014-09-09
gpg --edit-key AADE6532
gpg (GnuPG) 2.0.28; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Secret key is available.
pub 1024R/AADE6532 created: 2014-09-09 expires: never usage: SC
trust: unknown validity: unknown
sub 1024R/0A83CFB1 created: 2014-09-09 expires: never usage: E
[ unknown] (1). App Eng <[email protected]>
gpg> passwd
Key is protected.
You need a passphrase to unlock the secret key for
user: "App Eng <[email protected]>"
1024-bit RSA key, ID AADE6532, created 2014-09-09
gpg: cancelled by user
Can't edit this key: Operation cancelled
這讓我認為導入密鑰存在一些問題。誰能理解為什麼我無法使用安裝的金鑰來解密我的檔案?謝謝!
答案1
這個連結有答案: https://lists.gnupg.org/pipermail/gnupg-users/2013-April/046559.html
當我對其執行 sudo 時,在此主機上運行應用程式的特殊用戶沒有適當的 TTY 權限。因此,gpg 無法顯示 TTY GUI,只是失敗而沒有給出真正的原因。為了能夠做到這一點,我必須退出 navsrv sudo 會話,並進行以下呼叫:chmod o+rw `tty` && sudo -i -u navsrv gpg --edit-key 8267977F
接下來,我輸入了 navsrv 登入密碼。然後,在 gpg 命令提示字元下,當我執行「passwd」時,我得到了輸入密碼 GUI。