Created
January 27, 2017 00:47
-
-
Save d0c-s4vage/949d82b2a5a9ead306ff5a488bb21ef1 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
function aes_encrypt { | |
( | |
source ~/.aes.sh >/dev/null 2>&1 | |
test -t 0 >/dev/null 2>&1 | |
if [ $? -eq 0 ] ; then | |
decrypted="$1" | |
encrypted="$decrypted".enc | |
openssl enc -in "$decrypted" -out "$encrypted" -e -aes256 -k "$AES_KEY" | |
else | |
openssl enc -e -aes256 -k "$AES_KEY" | |
fi | |
) | |
} | |
function aes_decrypt { | |
( | |
source ~/.aes.sh >/dev/null 2>&1 | |
test -t 0 >/dev/null 2>&1 | |
if [ $? -eq 0 ] ; then | |
encrypted="$1" | |
decrypted="${encrypted%.*}" | |
openssl enc -in "$encrypted" -out "$decrypted" -d -aes256 -k "$AES_KEY" | |
else | |
openssl enc -d -aes256 -k "$AES_KEY" | |
fi | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment