How to use a GPG key stored on a flash drive to encrypt files? I was perplexed for sometime. Eventually I figured out instead of exporting, importing, file system linking.. you just use a remote key ring that contains the keys you want!
- Create the new key on the flash drive with
$ gpg --full-generate-key --homedir /Volumes/usb_flash_stick/key_homedir
- Use that new public key to encrypt files
$ gpg --encrypt-files --homedir /Volumes/usb_flash_stick/key_homedir -r XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ./file_a
This also bring the possibility of only storing the public key locally and having the secret key safe on the USB. See
how to move keys snippet.