2002-08-07 16:42:47 +00:00
|
|
|
# sm-sign+verify
|
|
|
|
#
|
2002-08-08 16:32:01 +00:00
|
|
|
# Creating a signature and verifying it
|
|
|
|
# Requirements: a plain file "text-1.txt"
|
2002-08-07 16:42:47 +00:00
|
|
|
|
2002-08-09 18:16:02 +00:00
|
|
|
srcdir = getenv srcdir
|
|
|
|
plaintext = let $srcdir/text-1.txt
|
2002-08-07 16:42:47 +00:00
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
in = openfile $plaintext
|
2002-08-07 16:42:47 +00:00
|
|
|
out = createfile msg.sig
|
|
|
|
in2 = openfile msg.sig
|
|
|
|
out2 = createfile msg.unsig
|
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
pipeserver $GPGSM
|
2002-08-07 16:42:47 +00:00
|
|
|
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
|
2002-08-08 16:32:01 +00:00
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
2002-08-07 16:42:47 +00:00
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
2002-08-08 16:32:01 +00:00
|
|
|
echo goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if !$goodsig
|
|
|
|
fail-if !$trusted
|
2002-08-07 16:42:47 +00:00
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
# Unset variables so that the files get closed.
|
|
|
|
in =
|
|
|
|
out =
|
|
|
|
in2 =
|
|
|
|
out2=
|
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
cmpfiles $plaintext msg.unsig
|
2002-08-07 16:42:47 +00:00
|
|
|
fail-if !$?
|
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
# 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.
|
2002-08-07 16:42:47 +00:00
|
|
|
in = openfile msg.sig
|
|
|
|
out = createfile msg.unsig
|
2002-08-08 16:32:01 +00:00
|
|
|
pipeserver $GPGSM
|
2002-08-07 16:42:47 +00:00
|
|
|
send INPUT FD=$in
|
|
|
|
expect-ok
|
|
|
|
send OUTPUT FD=$out
|
|
|
|
expect-ok
|
2002-08-08 16:32:01 +00:00
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
2002-08-07 16:42:47 +00:00
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
2002-08-08 16:32:01 +00:00
|
|
|
echo goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if !$goodsig
|
|
|
|
fail-if !$trusted
|
2002-08-07 16:42:47 +00:00
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
cmpfiles $plaintext msg.unsig
|
2002-08-07 16:42:47 +00:00
|
|
|
fail-if !$?
|
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
2002-08-07 16:42:47 +00:00
|
|
|
|
|
|
|
quit
|
|
|
|
|