chiark / gitweb /
asshelp.c: add a lot of debug logging
[gnupg2.git] / tests / pkits / validity-periods
1 #!/bin/sh
2 # validity-periods - PKITS Test 4.2                     -*- sh -*-
3 # Copyright (C) 2008 Free Software Foundation, Inc.  
4 #
5 # This file is part of GnuPG.
6
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.
11
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.
16
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/>.
19
20 . ${srcdir:-.}/common.sh || exit 2
21
22 section=4.2
23 description="Validity Periods"
24 info "Running $description tests"
25
26 start_test 4.2.1 "Invalid CA notBefore Date Test1"
27 # In this test, the intermediate certificate's notBefore date is after
28 # the current date.
29 clean_homedir
30 need_cert TrustAnchorRootCertificate
31 need_crl  TrustAnchorRootCRL
32 need_cert BadnotBeforeDateCACert
33 need_crl  BadnotBeforeDateCACRL
34 need_cert InvalidCAnotBeforeDateTest1EE
35 if $GPGSM --faked-system-time $MYTIME \
36           --with-colons --with-validation --list-key 0x459ADD33 >$SCRATCH; then
37     tmp=$($AWK -F: '$1 == "crt" {any=1; print $2};
38                     END {if(!any) print "error"}' $SCRATCH)
39     [ "$tmp" = "i" ] || set_status fail
40 else
41     set_status fail
42 fi
43 if [ "$test_status" = "none" ]; then
44     if sed  '1,/^.$/d' smime/SignedInvalidCAnotBeforeDateTest1.eml \
45         | $GPGSM --faked-system-time $MYTIME \
46                  --verify --assume-base64 --status-fd 1 --logger-fd 1 \
47         | tee $SCRATCH \
48         | grep TRUST_UNDEFINED >/dev/null; then
49         if grep 'intermediate certificate not yet valid' $SCRATCH >/dev/null \
50             && grep 'invalid certification chain: Certificate too young' \
51                     $SCRATCH >/dev/null
52           then
53             set_status pass
54         fi
55     fi
56     set_status fail
57 fi
58 end_test
59
60
61 start_test 4.2.2 "Invalid EE notBefore Date Test2"
62 # In this test, the end entity certificate's notBefore date is after
63 # the current date.
64
65 #    Procedure: Validate Invalid EE notBefore Date Test2 EE using the
66 #    default settings or open and verify Signed Test Message 6.2.2.5
67 #    using the default settings.
68
69 #    Expected Result: The path should not validate successfully as the
70 #    notBefore date in the end entity certificate is after the current
71 #    date.
72
73 #    Certification Path: The certification path is composed of the
74 #    following objects: Trust Anchor Root Certificate, Trust Anchor
75 #    Root CRL Good CA Cert, Good CA CRL Invalid EE notBefore Date
76 #    Test2 EE
77
78 end_test
79
80
81
82 start_test 4.2.3 "Valid pre2000 UTC notBefore Date Test3"
83 # In this test, the end entity certificate's notBefore date is set to
84 # 1950 and is encoded in UTCTime.
85 #
86 #    Procedure: Validate Valid pre2000 UTC notBefore Date Test3 EE
87 #                             using the default settings or open and
88 #                             verify Signed Test Message 6.2.2.6 using
89 #                             the default settings.
90 #
91 #    Expected Result: The path should validate successfully as the
92 #                             notBefore date in the end entity
93 #                             certificate is before the current date.
94 #
95 #    Certification Path: The certification path is composed of the
96 #                 following objects: Trust Anchor Root Certificate,
97 #                 Trust Anchor Root CRL Good CA Cert, Good CA CRL Valid
98 #                 pre2000 UTC notBefore Date Test3 EE
99 #
100 end_test 
101
102
103
104 start_test 4.2.4 "Valid GeneralizedTime notBefore Date Test4"
105 # In this test, the end entity certificate's notBefore date is
106 # specified in GeneralizedTime.
107 #
108 #    Procedure: Validate Valid GeneralizedTime notBefore Date Test4 EE
109 #                             using the default settings or open and
110 #                             verify Signed Test Message 6.2.2.7 using
111 #                             the default settings.
112 #
113 #    Expected Result:         The path should validate successfully.
114 #
115 #    Certification Path: 
116 #     The certification path is composed of the following objects:
117 #                 Trust Anchor Root Certificate, Trust Anchor Root CRL
118 #                 Good CA Cert, Good CA CRL
119 #                 Valid GeneralizedTime notBefore Date Test4 EE
120 #
121 end_test
122
123
124                 
125 start_test 4.2.5 "Invalid CA notAfter Date Test5"
126 # In this test, the intermediate certificate's notAfter date is before
127 # the current date.
128
129 #    Procedure: Validate Invalid CA notAfter Date Test5 EE using the
130 #                             default settings or open and verify
131 #                             Signed Test Message 6.2.2.8 using the
132 #                             default settings.
133 #
134 #    Expected Result: The path should not validate successfully as the
135 #                             notAfter date in the intermediate
136 #                             certificate is before the current date.
137 #
138 #    Certification Path: The certification path is composed of the
139 #    following objects:
140 #
141 #                 Trust Anchor Root Certificate, Trust Anchor Root CRL
142 #                 Bad notAfter Date CA Cert, Bad notAfter Date CA CRL
143 #                 Invalid CA notAfter Date Test5 EE
144 #
145 end_test
146
147                 
148 start_test 4.2.6 "Invalid EE notAfter Date Test6"
149 # In this test, the end entity certificate's notAfter date is before
150 # the current date.
151
152 #    Procedure: Validate Invalid EE notAfter Date Test6 EE using the
153 #                             default settings or open and verify
154 #                             Signed Test Message 6.2.2.9 using the
155 #                             default settings.
156 #
157 #    Expected Result: The path should not validate successfully as the
158 #                             notAfter date in the end certificate is
159 #                             before the current date.
160 #
161 #    Certification Path: The certification path is composed of the
162 #    following objects:
163 #                 Trust Anchor Root Certificate, Trust Anchor Root CRL
164 #                 Good CA Cert, Good CA CRL
165 #                 Invalid EE notAfter Date Test6 EE
166
167 end_test
168
169     
170 start_test 4.2.7 "Invalid pre2000 UTC EE notAfter Date Test7"
171 # In this test, the end entity certificate's notAfter date is 1999 and
172 # is encoded in UTCTime.
173
174 #    Procedure: Validate Invalid pre2000 UTC EE notAfter Date Test7 EE
175 #                             using the default settings or open and
176 #                             verify Signed Test Message 6.2.2.10 using
177 #                             the default settings.
178 #
179 #    Expected Result: The path should not validate successfully as the
180 #                             notAfter date in the end certificate is
181 #                             before the current date.
182 #
183 #
184 #    Certification Path: The certification path is composed of the
185 #    following objects:
186 #
187 #                 Trust Anchor Root Certificate, Trust Anchor Root CRL
188 #                 Good CA Cert, Good CA CRL
189 #                 Invalid pre2000 UTC EE notAfter Date Test7 EE
190
191 end_test
192
193                 
194
195 start_test 4.2.8 "Valid GeneralizedTime notAfter Date Test8"
196 # In this test, the end entity certificate's notAfter date is 2050 and
197 # is encoded in GeneralizedTime.
198
199 #    Procedure: Validate Valid GeneralizedTime notAfter Date Test8 EE
200 #                             using the default settings or open and
201 #                             verify Signed Test Message 6.2.2.11 using
202 #                             the default settings.
203 #
204 #    Expected Result: The path should validate successfully as the
205 #                             notAfter date in the end certificate is
206 #                             after the current date.
207 #
208 #
209 #                 Trust Anchor Root Certificate, Trust Anchor Root CRL
210 #                 Good CA Cert, Good CA CRL
211 #                 Valid GeneralizedTime notAfter Date Test8 EE
212
213 end_test
214
215
216
217
218 final_result