How to import Keybase private key to use locally with GPG


Keybase is a very handy way to verify identities. I wanted to use my Keybase key locally with GPG so that I could encrypt and sign things (specifically I was packaging a Sandstorm app).

In order to do that you need to get your Keybase public and private key installed locally. Here’s how:

1: Save your public Keybase key to a file called something like keybase-public.key. You can get this by clicking on the key Fingerprint on the keybase website:

Get Keybase public key

2: Save your private Keybase key to a file called keybase-private.key. You can get this by clicking on the ‘edit’ link to the right of the key Fingerprint on the keybase website:

Get Keybase private key

3: Import the keys to gpg:

gpg --allow-secret-key-import --import keybase-private.key
gpg --import keybase-public.key

You may wish to securely delete the private key file now to ensure it doesn’t fall into the wrong hands.

4: (Optional) Make the Keybase key your default key.

Get the keyID with gpg --list-secret-keys and make a note of the Keybase keyID.

Then edit ~/.gnupg/gpg.conf and add a line:

default-key <your-keynase-keyid-here>

That’s it - you can now use normal GPG commands to encrypt and sign things using your Keybase key.

comments powered by Disqus