diff options
author | Werner Koch <[email protected]> | 2021-05-31 13:29:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2021-05-31 19:51:45 +0000 |
commit | a8209b001cda393e472de1cdcffc354138890f36 (patch) | |
tree | 1b659e0928d1ba15df7a830819eb50f23a5edf57 /tests/cms/sm-verify | |
parent | gpgconf: Make runtime changes with different homedir work. (diff) | |
download | gnupg-a8209b001cda393e472de1cdcffc354138890f36.tar.gz gnupg-a8209b001cda393e472de1cdcffc354138890f36.zip |
tests: Rename subdir gpgsm to cms and move sample dirs.
--
It does not make sense to have the cms stuff at the top level but the
openpgp at a dedicated directory. This patch fixes that.
Diffstat (limited to 'tests/cms/sm-verify')
-rw-r--r-- | tests/cms/sm-verify | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/tests/cms/sm-verify b/tests/cms/sm-verify new file mode 100644 index 000000000..fa0932300 --- /dev/null +++ b/tests/cms/sm-verify @@ -0,0 +1,114 @@ +# sm-verify +# +# Verify a few distributed signatures. +# Requirements: +# + +srcdir = getenv srcdir + +# Check an opaque signature +sig = openfile $srcdir/text-1.osig.pem +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 = +cmpfiles $srcdir/text-1.txt msg.unsig +fail-if !$? + +# Check a detached signature. +sig = openfile $srcdir/text-1.dsig.pem +plain = openfile $srcdir/text-1.txt +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 +sig = openfile $srcdir/text-1.osig-bad.pem +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. +sig = openfile $srcdir/text-2.osig.pem + +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 also have tampered version. +sig = openfile $srcdir/text-2.osig-bad.pem + +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 + + |