Created
August 25, 2015 11:06
-
-
Save k2wanko/bc792b86f52dbe7f72e6 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
#!/bin/sh | |
root=`dirname $0`/.. | |
secret_dir=$root/.secret | |
suffix='.enc' | |
for target in $(find $secret_dir -name "*$suffix" ! -name ".*" -type f); do | |
file=$(echo $target | sed -e "s/.enc$//") | |
if [ -e $file ]; then | |
echo "Skip $file" | |
continue | |
fi | |
key=$(echo $SECURE_KEY | openssl dgst -md5 |sed 's/^.* //') | |
iv=$(echo ${key}${SECURE_KEY} | openssl dgst -md5 |sed 's/^.* //') | |
openssl enc -aes-256-cbc -d -K "$key" -iv "$iv" -a -salt -in ${target} -out ${file} | |
if [ $? -ne 0 ]; then | |
rm -rf $file | |
fi | |
done |
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/sh | |
root=`dirname $0`/.. | |
secret_dir=$root/.secret | |
suffix='.enc' | |
for target in $(find $secret_dir ! -name "*$suffix" ! -name ".*" -type f); do | |
if [ -e "${target}${suffix}" ]; then | |
rm -f ${target}${suffix} | |
fi | |
key=$(echo $SECURE_KEY | openssl dgst -md5 |sed 's/^.* //') | |
iv=$(echo ${key}${SECURE_KEY} | openssl dgst -md5 |sed 's/^.* //') | |
openssl enc -aes-256-cbc -K $key -iv $iv -a -salt -in ${target} -out ${target}${suffix} | |
if [ $? -ne 0 ]; then | |
rm -rf ${target}${suffix} | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment