2 # signature-verification - PKITS Test 4.1 -*- sh -*-
3 # Copyright (C) 2008 Free Software Foundation, Inc.
5 # This file is part of GnuPG.
7 # GnuPG is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # GnuPG is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, see <http://www.gnu.org/licenses/>.
20 .
${srcdir:-.}/common.sh ||
exit 2
23 description
="Signature Verification"
24 info
"Running $description tests"
27 start_test
4.1.1 "Valid Signatures Test1"
28 # The purpose of this test is to verify an application's ability to
29 # name chain, signature chain, and check validity dates, on
30 # certificates in a certification path. It also tests processing of
31 # the basic constraints and key usage extensions in intermediate
34 need_cert TrustAnchorRootCertificate
35 need_crl TrustAnchorRootCRL
38 need_cert ValidCertificatePathTest1EE
39 if $GPGSM --with-colons --with-validation --list-key 0x126B7002 >$SCRATCH; then
40 tmp
=$
($AWK -F: '$1 == "crt" {any=1; print $2};
41 END {if(!any) print "error"}' $SCRATCH)
42 [ -n "$tmp" ] && set_status fail
46 if [ "$test_status" = "none" ]; then
47 if sed '1,/^.$/d' smime
/SignedValidSignaturesTest1.eml \
48 |
$GPGSM --verify --assume-base64 --status-fd 1 \
49 |
grep TRUST_FULLY
>/dev
/null
; then
59 start_test
4.1.2 "Invalid CA Signatures Test2"
60 # The purpose of this test is to verify an application's ability to
61 # recognize an invalid signature on an intermediate certificate in a
64 need_cert TrustAnchorRootCertificate
65 need_crl TrustAnchorRootCRL
66 need_cert BadSignedCACert
--import-anyway
67 need_crl BadSignedCACRL
68 need_cert InvalidCASignatureTest2EE
--import-anyway
69 if $GPGSM --with-colons --with-validation --list-key 0xD667FE3C >$SCRATCH; then
70 tmp
=$
($AWK -F: '$1 == "crt" {any=1; print $2};
71 END {if(!any) print "error"}' $SCRATCH)
72 [ "$tmp" = "i" ] || set_status fail
76 if [ "$test_status" = "none" ]; then
77 if sed '1,/^.$/d' smime
/SignedInvalidCASignatureTest2.eml \
78 |
$GPGSM --verify --assume-base64 --status-fd 1 \
79 |
grep TRUST_NEVER
>/dev
/null
; then
89 start_test
4.1.3 "Invalid EE Signature Test3"
90 # The purpose of this test is to verify an application's ability to
91 # recognize an invalid signature on an end entity certificate in a
94 need_cert TrustAnchorRootCertificate
95 need_crl TrustAnchorRootCRL
98 need_cert InvalidEESignatureTest3EE
--import-anyway
99 if $GPGSM --with-colons --with-validation --list-key 0x42E1AEE3 >$SCRATCH; then
100 tmp
=$
($AWK -F: '$1 == "crt" {any=1; print $2};
101 END {if(!any) print "error"}' $SCRATCH)
102 [ "$tmp" = "i" ] || set_status fail
106 if [ "$test_status" = "none" ]; then
107 if sed '1,/^.$/d' smime
/SignedInvalidEESignatureTest3.eml \
108 |
$GPGSM --verify --assume-base64 --status-fd 1 \
109 |
grep TRUST_NEVER
>/dev
/null
; then
118 start_test
4.1.4 "Valid DSA Signatures Test4"
119 # The purpose of this test is to verify an application's ability to
120 # validate certificate in which DSA signatures are used. The
121 # intermediate CA and the end entity have DSA key pairs.
123 need_cert TrustAnchorRootCertificate
124 need_crl TrustAnchorRootCRL
127 need_cert ValidDSASignaturesTest4EE
128 if $GPGSM --with-colons --with-validation --list-key 0x820A72B8 >$SCRATCH; then
129 tmp
=$
($AWK -F: '$1 == "crt" {any=1; print $2};
130 END {if(!any) print "error"}' $SCRATCH)
131 [ -n "$tmp" ] && set_status fail
135 if [ "$test_status" = "none" ]; then
136 # Note: This S/MIME file uses LF and not CR,LF. */
137 if sed '1,/^$/d' smime
/SignedValidDSASignaturesTest4.eml \
138 |
$GPGSM --verify --assume-base64 --status-fd 1 \
139 |
grep TRUST_FULLY
>/dev
/null
; then
148 start_test
4.1.5 "Valid DSA Parameter Inheritance Test5"
149 # The purpose of this test is to verify an application's ability to
150 # validate DSA signatures when the DSA parameters are not included in
151 # a certificate and need to be inherited from a previous certificate
152 # in the path. The intermediate CAs and the end entity have DSA key
158 start_test
4.1.6 "Invalid DSA Signature Test6"
159 # The purpose of this test is to verify an application's ability to
160 # determine when a DSA signature is invalid. The intermediate CA and
161 # the end entity have DSA key pairs.