Skip to content

Instantly share code, notes, and snippets.

@stantonk
Last active May 20, 2019 02:03
Show Gist options
  • Save stantonk/1512289 to your computer and use it in GitHub Desktop.
Save stantonk/1512289 to your computer and use it in GitHub Desktop.
Easily encrypt/decrypt and secure delete plaintext files using GPG (GNU Privacy Guard / OpenPGP) on OS X
#!/bin/bash
if test -z "$1"
then
echo "usage: decrypt <filename>"
else
gpg -q --decrypt $1
fi
#!/bin/bash
RECIPIENT="youremail@domain.com"
if test -z "$1"
then
echo "usage: encrypt <filename>"
else
echo "Encrypting for $RECIPIENT..."
gpg --recipient $RECIPIENT --encrypt $1
rc=$?; if [[ $rc != 0 ]]; then echo "ERROR: failed to encrypt"; exit $rc; fi
echo "Complete."
echo "Securely deleting plaintext version..."
srm $1
echo "Complete!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment