]> git.scottworley.com Git - overonion/blame_incremental - overonion_test
Automate hash test
[overonion] / overonion_test
... / ...
CommitLineData
1#!/bin/bash
2
3test_data=$0
4
5# Verify hash mismatch is caught
6d=$(mktemp -d)
7./overonion-make-key --make_INSECURE_key "$d/key"
8cp "$d/key" "$d/key2"
9./overonion e "$d/key" < "$test_data" > "$d/encrypted"
10{ cat "$test_data"; echo tamper; } | ./overonion e "$d/key2" > "$d/encrypted2"
11if ./overonion d "$d/key" < "$d/encrypted2" > /dev/null;then
12 echo "Failed to detect tampering" >&2
13 exit 1
14fi
15rm -r "$d"
16
17
18
19# Verify normal operation
20set -e
21d=$(mktemp -d)
22./overonion-make-key --make_INSECURE_key "$d/key"
23./overonion e "$d/key" < "$test_data" > "$d/encrypted"
24./overonion d "$d/key" < "$d/encrypted" > "$d/roundtripped"
25cmp --verbose "$d/roundtripped" "$test_data"
26rm -r "$d"
27
28echo PASS