Encrypting Data with GnuPG

October 01, 2010 · 1 min read

There was recently [yet another](http://www.bbc.co.uk/news/technology-11434809) case of an organisation passing around unencrypted sensitive data. It keeps happening, and I'm constantly surprised that more people don't reach for the perfectly good encryption tools that are freely available. GnuPG is fast, free, and straightforward to use. If you handle sensitive files, there's really no excuse not to use it. ### Installing GnuPG I'm on macOS, so I use the [MacGPG2 package](http://sourceforge.net/projects/macgpg2/files/) (MacGPG2-2.0.14RC2 at the time of writing). Download the zip, unzip it, and run the installer. A few clicks and you're ready to start encrypting. ### Encrypting a file Say you have a file full of confidential data called `confidential-data.xls`. Run: ``` gpg -c ./confidential-data.xls ``` GnuPG will prompt you for a passphrase, then ask you to confirm it. Pick something strong. Once it finishes, you'll have a new file called `confidential-data.xls.gpg` -- that's the encrypted version. Delete the original and store the encrypted file wherever you need to. ### Decrypting a file When you need the data back, retrieve the encrypted file and run: ``` gpg -d ./confidential-data.xls.gpg --output ./confidential-data.xls ``` That's it. The decrypted file is back where it started. ### Not a command-line person? I use the command line, which might not be your thing. Honestly, it's not that scary, and I'd encourage you to give it a go. But if you prefer windows and drag-and-drop, take a look at something like [GPGDropThing](http://macgpg.sourceforge.net/) -- you can encrypt files just by dropping them onto it. The important thing is that you encrypt sensitive data *at all*. The specific tool matters less than the habit.

These posts are LLM-aided. Backbone, original writing, and structure by Craig. Research and editing by Craig + LLM. Proof-reading by Craig.