Created
November 6, 2014 18:28
-
-
Save nickabal/9ea1c060022b5d36fc92 to your computer and use it in GitHub Desktop.
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
# Pair of script for encrypt and decrypt directories using AES | |
#encrypt.sh | |
#!/bin/bash | |
wd=`pwd`; | |
if [ -z "$1" ]; then echo "./encrypt.sh <foldername>"; exit 1; fi | |
indir=$1 | |
out=$wd/ | |
basename=$(basename $1) | |
echo "Enter password. Save this somewhere safe!" | |
read passout | |
echo "Encrypting to: $out$basename.tar.enc" | |
tar c $indir | openssl enc -aes-256-cbc -e -pass pass:$passout > $out$basename.tar.enc | |
################################################### | |
################################################### | |
#decrypt.sh | |
#!/bin/bash | |
wd=`pwd`; | |
if [ -z "$1" ]; then echo "./decrypt.sh <file.enc>"; exit 1; fi | |
indir=$1 | |
out=$wd | |
echo "Enter password. Decrypting to: $wd/dec/" | |
read passin | |
mkdir -p $wd/dec/ | |
openssl enc -aes-256-cbc -d -pass pass:$passin -in $indir | tar -xf - -C $wd/dec/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment