生成密钥后 pubring.gpg 和 secring.gpg 丢失

2 encryption gnupg macos

我是 GnuPG 的新手。我正在按照“生成密钥对”的说明进行操作。最后我既没有看到也pubring.gpg没有secring.gpg在我的~/.gnupg目录中看到:

chriss-MBP:.gnupg andrej$ ls -la
total 24
drwx------  10 andrej  staff   340 Feb  5 23:20 .
drwxr-xr-x+ 44 andrej  staff  1496 Feb  5 23:17 ..
srwxr-xr-x   1 andrej  staff     0 Feb  5 23:19 S.gpg-agent
-rw-------   1 andrej  staff     0 Feb  5 23:17 dirmngr.conf
-rw-------   1 andrej  staff     0 Feb  5 23:17 gpg.conf
drwx------   3 andrej  staff   102 Feb  5 23:20 openpgp-revocs.d
drwx------   4 andrej  staff   136 Feb  5 23:20 private-keys-v1.d
-rw-r--r--   1 andrej  staff  1375 Feb  5 23:20 pubring.kbx
-rw-------   1 andrej  staff    32 Feb  5 23:17 pubring.kbx~
-rw-------   1 andrej  staff  1280 Feb  5 23:20 trustdb.gpg
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

密钥似乎是生成的:

chriss-MBP:~ andrej$ gpg2 --list-keys
/Users/andrej/.gnupg/pubring.kbx
--------------------------------
pub   rsa2048/E40D351A 2016-02-05 [SC]
uid         [ultimate] My Name <my@email.com>
sub   rsa2048/EA645178 2016-02-05 [E]
Run Code Online (Sandbox Code Playgroud)

我正在使用 GnuPG 2.1.11 版:

chriss-MBP:.gnupg andrej$ gpg2 --version
gpg (GnuPG) 2.1.11
libgcrypt 1.6.4
Run Code Online (Sandbox Code Playgroud)

我的 OS X 版本:

chriss-MBP:.gnupg andrej$ sw_vers -productVersion 
10.10.5
Run Code Online (Sandbox Code Playgroud)

Jen*_*rat 11

GnuPG 2.1(及更高版本)切换到具有更好性能的新密钥环格式。对于新生成的密钥环,密钥存储在pubring.kbx文件中。另一个变化是合并公钥和私钥,这就是为什么没有额外的secring.kbx.

换句话说:文件改变了,但你没有遗漏任何东西。

  • GnuPG 2.1 将私钥环合并到公钥环中,无论是旧的密钥环还是新的密钥盒格式。所以是的:“pubring.kbx”同时拥有公钥和私钥。 (2认同)

小智 5

如果您需要secring.gpg,请运行以下命令:

gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg
Run Code Online (Sandbox Code Playgroud)