Linux: Importing Keys from OpenKeychain (and Elsewhere) into GnuPG

Every now and again, I have to transfer my GPG keys to a new machine and I always forget how to do it. So, I figured I’d write a few notes to remember in the future.

Key detail: when you do a full back-up, it will export a file in the format: backup-YYYY-MM-DD.sec.pgp. You will also be given a password in the form of XXXX-XXXX-XXXX-XXXX-XXXX-XXXX. The password is a series of uppercase letters and numbers. So, at a command prompt in Linux, type:

$ gpg2 --decrypt backup_YYYY-MM-DD.sec.pgp | gpg2 --import

When you are prompted for the initial password, make sure to use the one in the format above and include the dashes. After, you will be prompted for the private key password(s) that have been backed up in order to import them.

I did cover this in my post on mutt, but I didn’t think to look there this time. So, I figure it deserves its own entry.