summaryrefslogtreecommitdiffstats
path: root/tests/sm-sign+verify
blob: 1c3ae7dbd370917d14c3f6f2242655104eadaae4 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# sm-sign+verify 
#
# Creating a signature and verifying it
# Requirements: a plain file "text-1.txt" 

srcdir = getenv srcdir
plaintext = let $srcdir/text-1.txt

in  = openfile $plaintext
out = createfile msg.sig
in2 = openfile msg.sig
out2 = createfile msg.unsig

pipeserver $GPGSM
send INPUT FD=$in
expect-ok
send OUTPUT FD=$out
expect-ok
send SIGN
expect-ok

send RESET
expect-ok
send INPUT FD=$in2
expect-ok
send OUTPUT FD=$out2
expect-ok
goodsig = count-status GOODSIG
trusted = count-status TRUST_FULLY
send VERIFY
expect-ok
echo goodsig=$goodsig trusted=$trusted
fail-if !$goodsig
fail-if !$trusted
send BYE
expect-ok

# Unset variables so that the files get closed.
in  =
out =
in2 = 
out2=

cmpfiles $plaintext msg.unsig
fail-if !$?

# Lets check it again with a new server instance, this time we keep
# the server running to check whether the entire message has been
# output after the VERIFY.
in = openfile msg.sig
out = createfile msg.unsig
pipeserver $GPGSM
send INPUT FD=$in
expect-ok
send OUTPUT FD=$out
expect-ok
goodsig = count-status GOODSIG
trusted = count-status TRUST_FULLY
send VERIFY
expect-ok
echo goodsig=$goodsig trusted=$trusted
fail-if !$goodsig
fail-if !$trusted

cmpfiles $plaintext msg.unsig
fail-if !$?

send BYE
expect-ok


quit