snippets/old_snippets/gpg-usb-workflow.md

24 lines
828 B
Markdown

---
title: "gpg usb workflow"
date: 2021-06-13T08:49:38+02:00
draft: false
snippet_types:
- gpg
---
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!
1. Create the new key on the flash drive with
```shell
$ gpg --full-generate-key --homedir /Volumes/usb_flash_stick/key_homedir
```
2. Use that new public key to encrypt files
```shell
$ 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](/snippets/moving-gpg-keys).