我已将我的 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。