-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTEST.sh
executable file
·146 lines (130 loc) · 4.16 KB
/
TEST.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
rm -rf test
mkdir test
ISLOCAL=1
ISREMOTE=1
FMT=""
while [ "$1" != "" ] ; do
if [ "$1" == "local" ] ; then ISREMOTE=0
elif [ "$1" == "remote" ] ; then ISLOCAL=0
else
FMT=".$1"
fi
shift
done
if [ $ISLOCAL == 1 ] ; then
echo "##### Local Key Generation Test"
for ka in rsa ec ; do
# generate keys
bin/sealtool -g --ka "$ka" -D "test/sign-$ka.dns" -k "test/sign-$ka.key" --genpass ''
done # ka
fi
if [ 1 == 1 ] ; then
echo ""
echo "##### Format Test"
for da in sha256 sha384 sha512 ; do
for ka in rsa ec ; do
# iterate over signing formats
for sf in 'hex' 'HEX' 'base64' 'date3:hex' 'date3:HEX' 'date3:base64' ; do
sfname=${sf/:/_}
# Test with local signing
if [ $ISLOCAL == 1 ] ; then
echo ""
echo "#### Local Signing $da $ka $sf"
echo ""
for i in regression/test-unsigned*"$FMT" ; do
j=${i/regression/test}
out=${j/-unsigned/-signed-local-$da-$ka-$sfname}
bin/sealtool -s -k "test/sign-$ka.key" --ka "$ka" --da "$da" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out" "$i"
done
# Verify local signing
echo ""
echo "#### Verify Local $da $ka $sf"
bin/sealtool --ka "$ka" --dnsfile "test/sign-$ka.dns" test/test-*local-$da-$ka-$sfname*
fi
# Test with remote signing
if [ $ISREMOTE == 1 ] ; then
echo ""
echo "#### Remote Signing $da $ka $sf"
for i in regression/test-unsigned*"$FMT" ; do
j=${i/regression/test}
out=${j/-unsigned/-signed-remote-$da-$ka-$sfname}
bin/sealtool -S --da "$da" --ka "$ka" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out" "$i"
done
# Verify remote signing
echo ""
echo "#### Verify Remote $da $ka $sf"
bin/sealtool test/test-*remote-$da-$ka-$sfname*
fi
done #sf
done # ka
done # da
fi
### PNG options
if [ "$FMT" == "" ] || [ "$FMT" == ".png" ] ; then
if [ $ISLOCAL == 1 ] ; then
echo ""
echo "##### PNG Chunk Test"
for opt in seAl sEAl sEAL seAL teXt ; do
i=regression/test-unsigned.png
ka=rsa
sf="date3:base64"
sfname=${sf/:/_}
j=${i/regression/test}
out=${j/-unsigned/-signed-local-pngchunk-$opt-$ka-$sfname}
echo ""
bin/sealtool -v -s -k "test/sign-$ka.key" --options "$opt" --ka "$ka" --dnsfile "test/sign-$ka.dns" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out" "$i"
echo ""
bin/sealtool -v --ka "$ka" --dnsfile "test/sign-$ka.dns" "$out"
done
fi
fi
### Append
if [ 1 == 1 ] ; then
if [ $ISLOCAL == 1 ] ; then
echo ""
echo "##### Append Test"
for ka in ec ; do
for sf in 'date3:hex' ; do
sfname=${sf/:/_}
for i in regression/test-unsigned*"$FMT" ; do
j=${i/regression/test}
out1=${j/-unsigned/-signed-local-append1-$ka-$sfname}
out2=${j/-unsigned/-signed-local-append2-$ka-$sfname}
out3=${j/-unsigned/-signed-local-append3-$ka-$sfname}
# create but leave open for appending
echo ""
bin/sealtool -v -s -k "test/sign-$ka.key" --options append --ka "$ka" --dnsfile "test/sign-$ka.dns" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out1" "$i"
echo ""
bin/sealtool -v --ka "$ka" --dnsfile "test/sign-$ka.dns" "$out1"
# append
echo ""
bin/sealtool -v -s -k "test/sign-$ka.key" --options append --ka "$ka" --dnsfile "test/sign-$ka.dns" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out2" "$out1"
echo ""
bin/sealtool -v --ka "$ka" --dnsfile "test/sign-$ka.dns" "$out2"
# finalize
echo ""
bin/sealtool -v -s -k "test/sign-$ka.key" --ka "$ka" --dnsfile "test/sign-$ka.dns" --sf "$sf" -C "Sample Copyright" -c "Sample Comment" -o "$out3" "$out2"
echo ""
bin/sealtool -v --ka "$ka" --dnsfile "test/sign-$ka.dns" "$out3"
done
done #sf
done # ka
fi
fi
### Try manual fields
if [ "$FMT" == "" ] || [ "$FMT" == ".jpg" ] ; then
if [ $ISREMOTE == 1 ] ; then
echo ""
echo "##### Manual Test"
echo ""
echo "#### Non-standard JPEG comment"
./SignManual.sh -Comment test/test-signed-remote-manual-comment.jpg
echo ""
echo "#### EXIF"
./SignManual.sh -EXIF:seal test/test-signed-remote-manual-exif.jpg
echo ""
echo "#### XMP"
./SignManual.sh -XMP:seal test/test-signed-remote-manual-xmp.jpg
fi
fi