Skip to content

Commit

Permalink
Moved new / non-writable file warnings above password prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
hmarr committed Aug 27, 2009
1 parent 651e0a1 commit 1db32c7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions aesvi
Expand Up @@ -25,17 +25,19 @@ fi

tmp=`mktemp` || exit 1

# Don't show the password as it's being typed
stty -echo
read -p "Password: " passwd; echo
stty echo

if [ ! -f $filename ]; then
echo "$filename doesn't exist. Starting from empty file."
elif [ ! -w $filename ]; then
echo "$filename isn't writable."
exit 1
else
fi

# Don't show the password as it's being typed
stty -echo
read -p "Password: " passwd; echo
stty echo

if [ -f $filename -a -w $filename ]; then
# Decrypt into the tmp file
openssl aes-256-cbc -a -d -in $filename -out $tmp -pass pass:$passwd \
2> /dev/null
Expand Down

0 comments on commit 1db32c7

Please sign in to comment.