2

How do I transfer public and private PGP Keys to a Mac OS X Lion machine?

2
  • 1
    Can you clarify what PGP implementation you use on both machines? – Jonas Malaco Aug 22 '14 at 18:14
  • I am using seahorse / GnuPG on Ubuntu and GPGTools on Mac – firmanium Aug 25 '14 at 5:58
7

Assuming that you are using GnuPG on Ubuntu...

First, you should export them:

gpg --export-secret-keys <keyid>  >key.gpg
gpg --export <keyid>  >>key.gpg

Then you should transfer this file to the Mac via a secure channel and import the keys on the recipient. You should be able to import the key via the graphical GPG Keychain, or through the command line (gpg --import key.gpg).

If you need to use a insecure channel to transfer the private key, such as email or other network based channels (where you don't have proper certificates ensuring that you are really communicating with the correct machine), you must use PGP (or some other method) to keep you private key secure:

  • On your Mac, create a temporary key pair send the public part to your Ubuntu machine
  • On your Ubuntu, check the fingerprint of the received key and encrypt 'key.gpg' with it, also signing it with you own key
  • Send both the Ubuntu public key and the encrypted 'key.gpg.gpg' file to the Mac
  • Again on your Mac, check the fingerprint of the received key and decrypt/verify the received 'key.gpg.gpg' file
1

Here's what I use for blindly transferring all of my GnuPG keys and keyring. Might not be a "best practice," but works well enough for me.

Using Magic Wormhole.

$ brew install magic-wormhole     # OSX
$ sudo apt install magic-wormhole # Linux

# Computer with keys:
$ wormhole send --ignore-unsendable-files $HOME/.gnupg

# Computer without keys:
$ cd $HOME
$ wormhole receive

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.