问题:使用 gpg -K 与 gpg -edit 时,我获得不同的密钥列表,并且丢失的密钥不能再用于解密。我该如何解决?
例子:
C:\...\>gpg --edit 11111111
gpg (GnuPG) 2.0.12; Copyright (C) 2009 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 2048R/11111111 created: 2012-09-09 expires: never usage: SC
trust: ultimate validity: ultimate
sub 2048R/22222222 created: 2012-09-09 expired: 2015-11-28 usage: E
sub 2048R/33333333 created: 2014-11-28 expired: 2015-11-28 usage: S
sub 2048R/44444444 created: 2015-12-08 expired: 2016-12-31 usage: S
sub 2048R/55555555 created: 2015-12-08 expired: 2016-12-31 usage: E
sub 4096R/66666666 created: 2016-12-28 expires: 2017-12-31 usage: S
sub 4096R/77777777 created: 2016-12-28 expires: 2017-12-31 usage: E
[ultimate] (1). Full Name <[email protected]>
C:\...\>gpg -K
C:/GnuPG/secring.gpg
--------------------
sec 2048R/11111111 2012-09-09
uid Full Name <[email protected]>
ssb 2048R/22222222 2012-09-09
ssb 2048R/33333333 2014-11-28
ssb 4096R/66666666 2016-12-28
ssb 4096R/77777777 2016-12-28
您会发现 gpg -K 中缺少 44444444 和 55555555。
尝试过的事情:添加新密钥并删除较新的密钥(曾经有一个仅列出最新密钥的错误)以及升级和降级 GPG4win 的版本。
如果这是 RTFM 问题,请建议搜索关键字。
注意:我在 Win10 上使用 Gpg4win,但如果有必要,我会启动 *nix 来解决这个问题。
答案1
问题重现:用户错误。
gpg -K 仅列出私钥。gpg --edit 列出公钥子密钥和私钥子密钥,但不区分何时缺少秘密子密钥。
当您导出公共子密钥、删除秘密子密钥,然后导入公共子密钥时,它看起来是这样的。
总结:PEBKAC