How do I transfer public and private PGP Keys to a Mac OS X Lion machine?
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
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