2002-08-08 16:32:01 +00:00
|
|
|
# sm-verify
|
|
|
|
#
|
|
|
|
# Verify a few distributed signatures.
|
|
|
|
# Requirements:
|
|
|
|
#
|
|
|
|
|
2002-08-09 18:16:02 +00:00
|
|
|
srcdir = getenv srcdir
|
|
|
|
|
2002-08-08 16:32:01 +00:00
|
|
|
# Check an opaque signature
|
2002-08-09 18:16:02 +00:00
|
|
|
sig = openfile $srcdir/text-1.osig.pem
|
2002-08-08 16:32:01 +00:00
|
|
|
out = createfile msg.unsig
|
|
|
|
pipeserver $GPGSM
|
|
|
|
send INPUT FD=$sig
|
|
|
|
expect-ok
|
|
|
|
send OUTPUT FD=$out
|
|
|
|
expect-ok
|
|
|
|
badsig = count-status BADSIG
|
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
|
|
|
echo badsig=$badsig goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if $badsig
|
|
|
|
fail-if !$goodsig
|
|
|
|
fail-if !$trusted
|
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
sig =
|
|
|
|
out =
|
2002-08-09 18:16:02 +00:00
|
|
|
cmpfiles $srcdir/text-1.txt msg.unsig
|
2002-08-08 16:32:01 +00:00
|
|
|
fail-if !$?
|
|
|
|
|
|
|
|
# Check a detached signature.
|
2002-08-09 18:16:02 +00:00
|
|
|
sig = openfile $srcdir/text-1.dsig.pem
|
|
|
|
plain = openfile $srcdir/text-1.txt
|
2002-08-08 16:32:01 +00:00
|
|
|
pipeserver $GPGSM
|
|
|
|
send INPUT FD=$sig
|
|
|
|
expect-ok
|
|
|
|
send MESSAGE FD=$plain
|
|
|
|
expect-ok
|
|
|
|
badsig = count-status BADSIG
|
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
|
|
|
echo badsig=$badsig goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if $badsig
|
|
|
|
fail-if !$goodsig
|
|
|
|
fail-if !$trusted
|
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
# Check a tampered opaque message
|
2002-08-09 18:16:02 +00:00
|
|
|
sig = openfile $srcdir/text-1.osig-bad.pem
|
2002-08-08 16:32:01 +00:00
|
|
|
out = createfile msg.unsig
|
|
|
|
|
|
|
|
pipeserver $GPGSM
|
|
|
|
send INPUT FD=$sig
|
|
|
|
expect-ok
|
|
|
|
send OUTPUT FD=$out
|
|
|
|
expect-ok
|
|
|
|
badsig = count-status BADSIG
|
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
|
|
|
echo badsig=$badsig goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if $goodsig
|
|
|
|
fail-if !$badsig
|
|
|
|
fail-if $trusted
|
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
# Check another opaque signature but without asking for the output.
|
2002-08-09 18:16:02 +00:00
|
|
|
sig = openfile $srcdir/text-2.osig.pem
|
2002-08-08 16:32:01 +00:00
|
|
|
|
|
|
|
pipeserver $GPGSM
|
|
|
|
send INPUT FD=$sig
|
|
|
|
expect-ok
|
|
|
|
badsig = count-status BADSIG
|
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
|
|
|
echo badsig=$badsig goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if $badsig
|
|
|
|
fail-if !$goodsig
|
|
|
|
fail-if !$trusted
|
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
# We als have tampered version.
|
2002-08-09 18:16:02 +00:00
|
|
|
sig = openfile $srcdir/text-2.osig-bad.pem
|
2002-08-08 16:32:01 +00:00
|
|
|
|
|
|
|
pipeserver $GPGSM
|
|
|
|
send INPUT FD=$sig
|
|
|
|
expect-ok
|
|
|
|
badsig = count-status BADSIG
|
|
|
|
goodsig = count-status GOODSIG
|
|
|
|
trusted = count-status TRUST_FULLY
|
|
|
|
send VERIFY
|
|
|
|
expect-ok
|
|
|
|
echo badsig=$badsig goodsig=$goodsig trusted=$trusted
|
|
|
|
fail-if $goodsig
|
|
|
|
fail-if !$badsig
|
|
|
|
fail-if $trusted
|
|
|
|
send BYE
|
|
|
|
expect-ok
|
|
|
|
|
|
|
|
|
|
|
|
quit
|
|
|
|
|
|
|
|
|