]>
Commit | Line | Data |
---|---|---|
636e3e5b SW |
1 | #!/bin/bash |
2 | ||
020ecc55 | 3 | test_data=$0 |
636e3e5b | 4 | |
020ecc55 | 5 | # Verify hash mismatch is caught |
636e3e5b | 6 | d=$(mktemp -d) |
020ecc55 SW |
7 | ./overonion-make-key --make_INSECURE_key "$d/key" |
8 | cp "$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" | |
11 | if ./overonion d "$d/key" < "$d/encrypted2" > /dev/null;then | |
12 | echo "Failed to detect tampering" >&2 | |
13 | exit 1 | |
14 | fi | |
15 | rm -r "$d" | |
636e3e5b | 16 | |
020ecc55 SW |
17 | |
18 | ||
19 | # Verify normal operation | |
20 | set -e | |
21 | d=$(mktemp -d) | |
636e3e5b | 22 | ./overonion-make-key --make_INSECURE_key "$d/key" |
64d0ba09 | 23 | ./overonion e "$d/key" < "$test_data" > "$d/encrypted" |
bcbeee4d SW |
24 | ./overonion d "$d/key" < "$d/encrypted" > "$d/roundtripped" |
25 | cmp --verbose "$d/roundtripped" "$test_data" | |
636e3e5b | 26 | rm -r "$d" |
020ecc55 | 27 | |
636e3e5b | 28 | echo PASS |