Last active
May 20, 2019 02:03
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if test -z "$1" | |
then | |
echo "usage: decrypt <filename>" | |
else | |
gpg -q --decrypt $1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RECIPIENT="[email protected]" | |
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