Skip to content

Instantly share code, notes, and snippets.

@pstaender
Last active August 5, 2016 16:12
Show Gist options
  • Save pstaender/c406b4354cdb5b2960d21f10799ea32f to your computer and use it in GitHub Desktop.
Save pstaender/c406b4354cdb5b2960d21f10799ea32f to your computer and use it in GitHub Desktop.
#!/bin/sh
# source: http://superuser.com/a/162628/398757
function tarcrypt {
file=$1
filename="$file.tar.gz.enc"
if [ -f $file ]; then
echo "-> $filename"
tar cz $file | openssl enc -aes-256-cbc -e > $filename
fi
}
function tardecrypt {
file=$1
openssl aes-256-cbc -d -in $file | tar xz
}
# test for encryption
# tarcrypt $1
# test for decryption
# tardecrypt $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment