Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active March 13, 2021 16:41
Show Gist options
  • Save plembo/961b54facd723c449f4b012982521427 to your computer and use it in GitHub Desktop.
Save plembo/961b54facd723c449f4b012982521427 to your computer and use it in GitHub Desktop.
Updating gnupg keychain from gpg to kbx

Bringing gnupg up to date: from gpg to kbx

GNU Privacy Guard made a change to its keystore with version 2.1 in 2014, including removal of the separate private keystore. The main difference users may notice is that the public keyring is now called "pubring.kbx" instead of "pubring.gpg". Its new keybox format is supposed to improve performance.

After continuing to use the old format through several upgrades, I finally decided to bring my evironment up to date.

The steps are in the GNUPg doc:

$ cd ~/.gnupg
$ gpg --export-ownertrust >otrust.lst
$ mv pubring.gpg publickeys.backup
$ gpg --import-options restore --import publickeys.backup
$ gpg --import-ownertrust otrust.lst

In the original there's a typo in line 4 (importing the publickeys.backup, which they have erroneously as "publickeys.backups") that I've corrected above. When you're done things should like a something like this:

mw@mine:~/.gnupg$ ls
crls.d          openpgp-revocs.d   publickeys.backup  pubring.kbx~  sshcontrol
gpg-agent.conf  otrust.lst         pubring.gpg~       random_seed   tofu.db
gpg.conf        private-keys-v1.d  pubring.kbx        secring.gpg   trustdb.gpg

I am keeping my secring.gpg for now "in case you have to use GnuPG 1.4 to decrypt archived data.". The GNU Privacy Guard Manual. Version 2.2.26, December 2020. Section 4.3, "Configuration Files", retrieved March 13, 2021, https://www.gnupg.org/documentation/manuals/gnupg/GPG-Configuration.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment