X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=enc.sh;h=de4c2a86d440fa3cb8957df583732fd850ace3ec;hb=f6b5e5eaa2e641d32878ff485f3e54de2eb35552;hp=a0ec8ef70b2af58ebbad2ce6ba5642af2414e821;hpb=aaee3c8df14e4d369807541055c55fa06265d551;p=cmccabe-bin diff --git a/enc.sh b/enc.sh index a0ec8ef..de4c2a8 100755 --- a/enc.sh +++ b/enc.sh @@ -5,8 +5,13 @@ die() { exit 1 } -[ "x${SALT}" = "x" ] && die "you must set SALT to the salt." -[ "x${PASS}" = "x" ] && die "you must set PASS to the password" +if [[ "x${PASS}" = "x" ]]; then + read -s -p "enter password: " PASS +fi + +#[ "x${SALT}" = "x" ] && die "you must set SALT to the salt." +#SALT=$(dd count=1024 if=/dev/random 2>/dev/null |md5sum|sed 's/-//') +#[ $? -ne 0 ] && die "failed to generate SALT" RET=0 for FILE in "$@"; do @@ -18,7 +23,7 @@ for FILE in "$@"; do echo "Not encrypting ${FILE} because there is already a ${NEW_FILE}" else if openssl enc -aes-256-ecb \ - -S "${SALT}" \ + -salt \ -k "${PASS}" < "${FILE}" > "${NEW_FILE}"; then echo "Created ${NEW_FILE}" else