aboutsummaryrefslogtreecommitdiff
path: root/cmd/sigsum/signify_test.sh
blob: 7ff26ec9e9a97db5de395fc8bc2f29d9398b5675 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash

set -e
trap cleanup EXIT

pass=1234
priv=testonly/signify.sec
pub=testonly/signify.pub
domain_hint=_sigsum_v0.test-only.rgdd.se
msg=msg-$(date +%s)
num_msg=3

function cleanup() {
	set +e

	rm -f sigsum
	for i in $(seq 1 $num_msg); do
		rm -f $msg-$i{,.trunnel,.sig}
	done

	exit
}

go build .

files=""
for i in $(seq 1 $num_msg); do
	echo $msg-$i > $msg-$i
	if ! ./sigsum format $msg-$i > $msg-$i.trunnel; then
		echo "[FAIL] format for $num_msg signify message(s)" >&2
		exit 1
	fi
	if ! echo $pass | signify-openbsd -Ss $priv -m $msg-$i.trunnel -x $msg-$i.sig; then
		echo "[FAIL] sign for $num_msg signify message(s)" >&2
		exit 1
	fi
	files=$(echo -n $files $msg-$i)
done

echo "[PASS] format for $num_msg signify message(s)" >&2
echo "[PASS] sign for $num_msg signify message(s)" >&2

if ! ./sigsum bundle -t signify -k $pub -d $domain_hint $files; then
	echo "[FAIL] bundle for $num_msg signify message(s)" >&2
	exit 1
fi

echo "[PASS] bundle for $num_msg signify message(s)" >&2

if ! ./sigsum verify -t signify -k $pub $files; then
	echo "[FAIL] verify for $num_msg signify message(s)" >&2
	exit 1
fi

echo "[PASS] verify for $num_msg signify message(s)" >&2