develop with

Decrypt GPG data

How to decrypt data that is base64 encoded and gpg encrypted.

Most of the time you are sent data that is encrypted it is base64 encoded. This allows bytes to be sent in plain text to allow you to copy them appropriately on any machine.

To unencode the base64 string on unix / linux:

echo 'SGVsbG8gYmFzZTY0' | base64 -D

Make sure you have your gpg keys installed by running gpg --list-secret-keys --keyid-format LONG, this will list the secret keys and allows you to know what pairs you have on your local machine.

Here is an example of decrypting the base64 decoded string:

echo "<gpg base64 encoded string>" | base64 -D  gpg -d

Feel free to steal the simple script approach that is on that gist.

comments powered by Disqus

Want to see a topic covered? create a suggestion

Get more developer references and books in the developwith store.