X-Git-Url: http://git.scottworley.com/overonion/blobdiff_plain/636e3e5b935d67b52989f948d80fb151e330f21c..a4f749134de875d82a0ca5d8251968db429558d3:/overonion_test diff --git a/overonion_test b/overonion_test index 6ec2d61..85c782b 100755 --- a/overonion_test +++ b/overonion_test @@ -1,11 +1,28 @@ #!/bin/bash -set -e +test_data=$0 +# Verify hash mismatch is caught d=$(mktemp -d) -test_data=$0 +./overonion-make-key --make_INSECURE_key "$d/key" +cp "$d/key" "$d/key2" +./overonion e "$d/key" < "$test_data" > "$d/encrypted" +{ cat "$test_data"; echo tamper; } | ./overonion e "$d/key2" > "$d/encrypted2" +if ./overonion d "$d/key" < "$d/encrypted2" > /dev/null;then + echo "Failed to detect tampering" >&2 + exit 1 +fi +rm -r "$d" + + +# Verify normal operation +set -e +d=$(mktemp -d) ./overonion-make-key --make_INSECURE_key "$d/key" -cmp --verbose <(./overonion e "$d/key" < "$test_data" | ./overonion d "$d/key") "$test_data" +./overonion e "$d/key" < "$test_data" > "$d/encrypted" +./overonion d "$d/key" < "$d/encrypted" > "$d/roundtripped" +cmp --verbose "$d/roundtripped" "$test_data" rm -r "$d" + echo PASS