| 1 |
# sm-sign+verify |
| 2 |
# |
| 3 |
# Creating a signature and verifying it |
| 4 |
# Requirements: a plain file "text-1.txt" |
| 5 |
|
| 6 |
srcdir = getenv srcdir |
| 7 |
plaintext = let $srcdir/text-1.txt |
| 8 |
|
| 9 |
in = openfile $plaintext |
| 10 |
out = createfile msg.sig |
| 11 |
in2 = openfile msg.sig |
| 12 |
out2 = createfile msg.unsig |
| 13 |
|
| 14 |
pipeserver $GPGSM |
| 15 |
send INPUT FD=$in |
| 16 |
expect-ok |
| 17 |
send OUTPUT FD=$out |
| 18 |
expect-ok |
| 19 |
send SIGN |
| 20 |
expect-ok |
| 21 |
|
| 22 |
send RESET |
| 23 |
expect-ok |
| 24 |
send INPUT FD=$in2 |
| 25 |
expect-ok |
| 26 |
send OUTPUT FD=$out2 |
| 27 |
expect-ok |
| 28 |
goodsig = count-status GOODSIG |
| 29 |
trusted = count-status TRUST_FULLY |
| 30 |
send VERIFY |
| 31 |
expect-ok |
| 32 |
echo goodsig=$goodsig trusted=$trusted |
| 33 |
fail-if !$goodsig |
| 34 |
fail-if !$trusted |
| 35 |
send BYE |
| 36 |
expect-ok |
| 37 |
|
| 38 |
# Unset variables so that the files get closed. |
| 39 |
in = |
| 40 |
out = |
| 41 |
in2 = |
| 42 |
out2= |
| 43 |
|
| 44 |
cmpfiles $plaintext msg.unsig |
| 45 |
fail-if !$? |
| 46 |
|
| 47 |
# Lets check it again with a new server instance, this time we keep |
| 48 |
# the server running to check whether the entire message has been |
| 49 |
# output after the VERIFY. |
| 50 |
in = openfile msg.sig |
| 51 |
out = createfile msg.unsig |
| 52 |
pipeserver $GPGSM |
| 53 |
send INPUT FD=$in |
| 54 |
expect-ok |
| 55 |
send OUTPUT FD=$out |
| 56 |
expect-ok |
| 57 |
goodsig = count-status GOODSIG |
| 58 |
trusted = count-status TRUST_FULLY |
| 59 |
send VERIFY |
| 60 |
expect-ok |
| 61 |
echo goodsig=$goodsig trusted=$trusted |
| 62 |
fail-if !$goodsig |
| 63 |
fail-if !$trusted |
| 64 |
|
| 65 |
cmpfiles $plaintext msg.unsig |
| 66 |
fail-if !$? |
| 67 |
|
| 68 |
send BYE |
| 69 |
expect-ok |
| 70 |
|
| 71 |
|
| 72 |
quit |
| 73 |
|