8 if [[ "x${PASS}" = "x" ]]; then
9 read -s -p "enter password: " PASS
11 read -s -p "re-enter password: " PASS2
12 [[ ${PASS} == ${PASS2} ]] || die "The passwords did not match."
15 #[ "x${SALT}" = "x" ] && die "you must set SALT to the salt."
16 #SALT=$(dd count=1024 if=/dev/random 2>/dev/null |md5sum|sed 's/-//')
17 #[ $? -ne 0 ] && die "failed to generate SALT"
21 if [[ "${FILE}" = *.nc ]]; then
22 echo "Not encrypting ${FILE} because its name already ends in .nc"
25 if [ -e "${NEW_FILE}" ]; then
26 echo "Not encrypting ${FILE} because there is already a ${NEW_FILE}"
28 if openssl enc -aes-256-ecb \
30 -k "${PASS}" < "${FILE}" > "${NEW_FILE}"; then
31 echo "Created ${NEW_FILE}"
33 echo "Failed to create ${NEW_FILE}"