diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:59:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 09:59:15 +0000 |
commit | 8de1ee1b2b676b0d07586f0752750dd6b0fb7511 (patch) | |
tree | dd46fd7dc3863045696cd0e48032d8a36fa0daf5 /tests/sm-verify | |
parent | Initial commit. (diff) | |
download | gnupg2-upstream.tar.xz gnupg2-upstream.zip |
Adding upstream version 2.2.27.upstream/2.2.27upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/sm-verify')
-rw-r--r-- | tests/sm-verify | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/tests/sm-verify b/tests/sm-verify new file mode 100644 index 0000000..b06dc16 --- /dev/null +++ b/tests/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 als 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 + + |