]> git.scottworley.com Git - overonion/blame - overonion_test
Don't use salt for encryption
[overonion] / overonion_test
CommitLineData
636e3e5b
SW
1#!/bin/bash
2
020ecc55 3test_data=$0
636e3e5b 4
020ecc55 5# Verify hash mismatch is caught
636e3e5b 6d=$(mktemp -d)
020ecc55
SW
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"
636e3e5b 16
020ecc55
SW
17
18
19# Verify normal operation
20set -e
21d=$(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"
25cmp --verbose "$d/roundtripped" "$test_data"
636e3e5b 26rm -r "$d"
020ecc55 27
636e3e5b 28echo PASS