Adds helpers for single file symmetric encryption / decryption

This commit is contained in:
William Carroll 2017-06-21 14:18:44 -04:00
parent 9d591e52ac
commit 71bb47c7a3

View file

@ -2,7 +2,9 @@
function gpg-encrypt-dir() { function gpg-encrypt-dir() {
dirname=$1 dirname=$1
echo "Encrypting..."
tar -cz "$dirname" | gpg --symmetric --output "$dirname.tar.gz.gpg" tar -cz "$dirname" | gpg --symmetric --output "$dirname.tar.gz.gpg"
echo "Done."
} }
@ -14,7 +16,27 @@ function gpg-decrypt-dir() {
echo "Output directory, $outdir, already exists and will be overwritten by this command. Aborting..." echo "Output directory, $outdir, already exists and will be overwritten by this command. Aborting..."
exit 1 exit 1
else else
echo "Decrypting..."
gpg --decrypt $dirname | tar -xv gpg --decrypt $dirname | tar -xv
echo "Done."
fi fi
} }
# WIP
function gpg-encrypt-file() {
filename=$1
echo "Encrypting..."
gpg --symmetric $filename
echo "Done."
}
# WIP
function gpg-decrypt-file() {
filename=$1
echo "Decrypting..."
gpg --decrypt $filename >"${filename%.gpg}"
echo "Done."
}