6abc81b5a359128477330f3253dec7839a67d725
[gnupg.git] / tests / sm-verify
1 # sm-verify 
2 #
3 # Verify a few distributed signatures.
4 # Requirements: 
5 #
6
7 # Check an opaque signature
8 sig = openfile text-1.osig.pem
9 out = createfile msg.unsig
10 pipeserver $GPGSM
11 send INPUT FD=$sig
12 expect-ok
13 send OUTPUT FD=$out
14 expect-ok
15 badsig  = count-status BADSIG
16 goodsig = count-status GOODSIG
17 trusted = count-status TRUST_FULLY
18 send VERIFY
19 expect-ok
20 echo badsig=$badsig goodsig=$goodsig trusted=$trusted
21 fail-if $badsig
22 fail-if !$goodsig
23 fail-if !$trusted
24 send BYE
25 expect-ok
26
27 sig =
28 out =
29 cmpfiles text-1.txt msg.unsig
30 fail-if !$?
31
32 # Check a detached signature.
33 sig = openfile text-1.dsig.pem
34 plain = openfile text-1.txt
35 pipeserver $GPGSM
36 send INPUT FD=$sig
37 expect-ok
38 send MESSAGE FD=$plain
39 expect-ok
40 badsig  = count-status BADSIG
41 goodsig = count-status GOODSIG
42 trusted = count-status TRUST_FULLY
43 send VERIFY
44 expect-ok
45 echo badsig=$badsig goodsig=$goodsig trusted=$trusted
46 fail-if $badsig
47 fail-if !$goodsig
48 fail-if !$trusted
49 send BYE
50 expect-ok
51
52 # Check a tampered opaque message
53 sig = openfile text-1.osig-bad.pem
54 out = createfile msg.unsig
55
56 pipeserver $GPGSM
57 send INPUT FD=$sig
58 expect-ok
59 send OUTPUT FD=$out
60 expect-ok
61 badsig  = count-status BADSIG
62 goodsig = count-status GOODSIG
63 trusted = count-status TRUST_FULLY
64 send VERIFY
65 expect-ok
66 echo badsig=$badsig goodsig=$goodsig trusted=$trusted
67 fail-if $goodsig
68 fail-if !$badsig
69 fail-if $trusted
70 send BYE
71 expect-ok
72
73 # Check another opaque signature but without asking for the output.
74 sig = openfile text-2.osig.pem
75
76 pipeserver $GPGSM
77 send INPUT FD=$sig
78 expect-ok
79 badsig  = count-status BADSIG
80 goodsig = count-status GOODSIG
81 trusted = count-status TRUST_FULLY
82 send VERIFY
83 expect-ok
84 echo badsig=$badsig goodsig=$goodsig trusted=$trusted
85 fail-if $badsig
86 fail-if !$goodsig
87 fail-if !$trusted
88 send BYE
89 expect-ok
90
91 # We als have tampered version.
92 sig = openfile text-2.osig-bad.pem
93
94 pipeserver $GPGSM
95 send INPUT FD=$sig
96 expect-ok
97 badsig  = count-status BADSIG
98 goodsig = count-status GOODSIG
99 trusted = count-status TRUST_FULLY
100 send VERIFY
101 expect-ok
102 echo badsig=$badsig goodsig=$goodsig trusted=$trusted
103 fail-if $goodsig
104 fail-if !$badsig
105 fail-if $trusted
106 send BYE
107 expect-ok
108
109
110 quit
111
112