mirror of
https://github.com/5im-0n/sshenc.sh.git
synced 2025-08-02 19:30:05 +02:00
add more tests
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
cleanup() {
|
cleanup() {
|
||||||
rm -rf "$tempfile"
|
rm -rf "$temp_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
temp_dir="$(mktemp -d -t "sshenc.sh.XXXXXX")"
|
||||||
tempfile=$(tempfile)
|
tempfile="$(mktemp "$temp_dir/sshenc.sh.XXXXXX.cypher")"
|
||||||
plaintext=$(cat sometext)
|
plaintext=$(cat sometext)
|
||||||
|
|
||||||
echo -n 'testing multiple pubkeys: '
|
echo -n 'testing multiple pubkeys: '
|
||||||
@@ -19,6 +19,29 @@ for i in {1..3}; do
|
|||||||
echo -n "key$i: ⛝ "
|
echo -n "key$i: ⛝ "
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n 'testing encryption with a single key: '
|
||||||
|
../sshenc.sh -p id_rsa-1.pub < sometext > $tempfile
|
||||||
|
cyph=$(../sshenc.sh -s id_rsa-1 < $tempfile)
|
||||||
|
if [ "$cyph" == "$plaintext" ]; then
|
||||||
|
echo -n "✓"
|
||||||
|
else
|
||||||
|
echo -n "⛝"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n 'testing encryption of a binary file: '
|
||||||
|
../sshenc.sh -p id_rsa-1.pub < ../logo.png > $tempfile
|
||||||
|
../sshenc.sh -s id_rsa-1 < $tempfile > $temp_dir/binary
|
||||||
|
diff ../logo.png $temp_dir/binary
|
||||||
|
retval=$?
|
||||||
|
if [ $retval -eq 0 ]; then
|
||||||
|
echo -n "✓"
|
||||||
|
else
|
||||||
|
echo -n "⛝"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo done.
|
echo done.
|
||||||
|
Reference in New Issue
Block a user