xref: /freebsd/crypto/openssl/test/pkits-test.pl (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert#! /usr/bin/env perl
2*e0c4386eSCy Schubert# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
3*e0c4386eSCy Schubert#
4*e0c4386eSCy Schubert# Licensed under the Apache License 2.0 (the "License").  You may not use
5*e0c4386eSCy Schubert# this file except in compliance with the License.  You can obtain a copy
6*e0c4386eSCy Schubert# in the file LICENSE in the source distribution or at
7*e0c4386eSCy Schubert# https://www.openssl.org/source/license.html
8*e0c4386eSCy Schubert
9*e0c4386eSCy Schubert# Perl utility to run PKITS tests for RFC3280 compliance.
10*e0c4386eSCy Schubert
11*e0c4386eSCy Schubertmy $ossl_path;
12*e0c4386eSCy Schubert
13*e0c4386eSCy Schubertif ( -f "../apps/openssl" ) {
14*e0c4386eSCy Schubert    $ossl_path = "../util/shlib_wrap.sh ../apps/openssl";
15*e0c4386eSCy Schubert}
16*e0c4386eSCy Schubertelsif ( -f "..\\out32dll\\openssl.exe" ) {
17*e0c4386eSCy Schubert    $ossl_path = "..\\out32dll\\openssl.exe";
18*e0c4386eSCy Schubert}
19*e0c4386eSCy Schubertelsif ( -f "..\\out32\\openssl.exe" ) {
20*e0c4386eSCy Schubert    $ossl_path = "..\\out32\\openssl.exe";
21*e0c4386eSCy Schubert}
22*e0c4386eSCy Schubertelse {
23*e0c4386eSCy Schubert    die "Can't find OpenSSL executable";
24*e0c4386eSCy Schubert}
25*e0c4386eSCy Schubert
26*e0c4386eSCy Schubertmy $pkitsdir = "pkits/smime";
27*e0c4386eSCy Schubertmy $pkitsta = "pkits/certs/TrustAnchorRootCertificate.crt";
28*e0c4386eSCy Schubert
29*e0c4386eSCy Schubertdie "Can't find PKITS test data" if !-d $pkitsdir;
30*e0c4386eSCy Schubert
31*e0c4386eSCy Schubertmy $nist1 = "2.16.840.1.101.3.2.1.48.1";
32*e0c4386eSCy Schubertmy $nist2 = "2.16.840.1.101.3.2.1.48.2";
33*e0c4386eSCy Schubertmy $nist3 = "2.16.840.1.101.3.2.1.48.3";
34*e0c4386eSCy Schubertmy $nist4 = "2.16.840.1.101.3.2.1.48.4";
35*e0c4386eSCy Schubertmy $nist5 = "2.16.840.1.101.3.2.1.48.5";
36*e0c4386eSCy Schubertmy $nist6 = "2.16.840.1.101.3.2.1.48.6";
37*e0c4386eSCy Schubert
38*e0c4386eSCy Schubertmy $apolicy = "X509v3 Any Policy";
39*e0c4386eSCy Schubert
40*e0c4386eSCy Schubert# This table contains the chapter headings of the accompanying PKITS
41*e0c4386eSCy Schubert# document. They provide useful informational output and their names
42*e0c4386eSCy Schubert# can be converted into the filename to test.
43*e0c4386eSCy Schubert
44*e0c4386eSCy Schubertmy @testlists = (
45*e0c4386eSCy Schubert    [ "4.1", "Signature Verification" ],
46*e0c4386eSCy Schubert    [ "4.1.1", "Valid Signatures Test1",                        0 ],
47*e0c4386eSCy Schubert    [ "4.1.2", "Invalid CA Signature Test2",                    7 ],
48*e0c4386eSCy Schubert    [ "4.1.3", "Invalid EE Signature Test3",                    7 ],
49*e0c4386eSCy Schubert    [ "4.1.4", "Valid DSA Signatures Test4",                    0 ],
50*e0c4386eSCy Schubert    [ "4.1.5", "Valid DSA Parameter Inheritance Test5",         0 ],
51*e0c4386eSCy Schubert    [ "4.1.6", "Invalid DSA Signature Test6",                   7 ],
52*e0c4386eSCy Schubert    [ "4.2",   "Validity Periods" ],
53*e0c4386eSCy Schubert    [ "4.2.1", "Invalid CA notBefore Date Test1",               9 ],
54*e0c4386eSCy Schubert    [ "4.2.2", "Invalid EE notBefore Date Test2",               9 ],
55*e0c4386eSCy Schubert    [ "4.2.3", "Valid pre2000 UTC notBefore Date Test3",        0 ],
56*e0c4386eSCy Schubert    [ "4.2.4", "Valid GeneralizedTime notBefore Date Test4",    0 ],
57*e0c4386eSCy Schubert    [ "4.2.5", "Invalid CA notAfter Date Test5",                10 ],
58*e0c4386eSCy Schubert    [ "4.2.6", "Invalid EE notAfter Date Test6",                10 ],
59*e0c4386eSCy Schubert    [ "4.2.7", "Invalid pre2000 UTC EE notAfter Date Test7",    10 ],
60*e0c4386eSCy Schubert    [ "4.2.8", "Valid GeneralizedTime notAfter Date Test8",     0 ],
61*e0c4386eSCy Schubert    [ "4.3",   "Verifying Name Chaining" ],
62*e0c4386eSCy Schubert    [ "4.3.1", "Invalid Name Chaining EE Test1",                20 ],
63*e0c4386eSCy Schubert    [ "4.3.2", "Invalid Name Chaining Order Test2",             20 ],
64*e0c4386eSCy Schubert    [ "4.3.3", "Valid Name Chaining Whitespace Test3",          0 ],
65*e0c4386eSCy Schubert    [ "4.3.4", "Valid Name Chaining Whitespace Test4",          0 ],
66*e0c4386eSCy Schubert    [ "4.3.5", "Valid Name Chaining Capitalization Test5",      0 ],
67*e0c4386eSCy Schubert    [ "4.3.6", "Valid Name Chaining UIDs Test6",                0 ],
68*e0c4386eSCy Schubert    [ "4.3.7", "Valid RFC3280 Mandatory Attribute Types Test7", 0 ],
69*e0c4386eSCy Schubert    [ "4.3.8", "Valid RFC3280 Optional Attribute Types Test8",  0 ],
70*e0c4386eSCy Schubert    [ "4.3.9", "Valid UTF8String Encoded Names Test9",          0 ],
71*e0c4386eSCy Schubert    [ "4.3.10", "Valid Rollover from PrintableString to UTF8String Test10", 0 ],
72*e0c4386eSCy Schubert    [ "4.3.11", "Valid UTF8String Case Insensitive Match Test11",           0 ],
73*e0c4386eSCy Schubert    [ "4.4",    "Basic Certificate Revocation Tests" ],
74*e0c4386eSCy Schubert    [ "4.4.1",  "Missing CRL Test1",                                        3 ],
75*e0c4386eSCy Schubert    [ "4.4.2", "Invalid Revoked CA Test2",          23 ],
76*e0c4386eSCy Schubert    [ "4.4.3", "Invalid Revoked EE Test3",          23 ],
77*e0c4386eSCy Schubert    [ "4.4.4", "Invalid Bad CRL Signature Test4",   8 ],
78*e0c4386eSCy Schubert    [ "4.4.5", "Invalid Bad CRL Issuer Name Test5", 3 ],
79*e0c4386eSCy Schubert    [ "4.4.6", "Invalid Wrong CRL Test6",           3 ],
80*e0c4386eSCy Schubert    [ "4.4.7", "Valid Two CRLs Test7",              0 ],
81*e0c4386eSCy Schubert
82*e0c4386eSCy Schubert    # The test document suggests these should return certificate revoked...
83*e0c4386eSCy Schubert    # Subsequent discussion has concluded they should not due to unhandle
84*e0c4386eSCy Schubert    # critical CRL extensions.
85*e0c4386eSCy Schubert    [ "4.4.8", "Invalid Unknown CRL Entry Extension Test8", 36 ],
86*e0c4386eSCy Schubert    [ "4.4.9", "Invalid Unknown CRL Extension Test9",       36 ],
87*e0c4386eSCy Schubert
88*e0c4386eSCy Schubert    [ "4.4.10", "Invalid Unknown CRL Extension Test10",             36 ],
89*e0c4386eSCy Schubert    [ "4.4.11", "Invalid Old CRL nextUpdate Test11",                12 ],
90*e0c4386eSCy Schubert    [ "4.4.12", "Invalid pre2000 CRL nextUpdate Test12",            12 ],
91*e0c4386eSCy Schubert    [ "4.4.13", "Valid GeneralizedTime CRL nextUpdate Test13",      0 ],
92*e0c4386eSCy Schubert    [ "4.4.14", "Valid Negative Serial Number Test14",              0 ],
93*e0c4386eSCy Schubert    [ "4.4.15", "Invalid Negative Serial Number Test15",            23 ],
94*e0c4386eSCy Schubert    [ "4.4.16", "Valid Long Serial Number Test16",                  0 ],
95*e0c4386eSCy Schubert    [ "4.4.17", "Valid Long Serial Number Test17",                  0 ],
96*e0c4386eSCy Schubert    [ "4.4.18", "Invalid Long Serial Number Test18",                23 ],
97*e0c4386eSCy Schubert    [ "4.4.19", "Valid Separate Certificate and CRL Keys Test19",   0 ],
98*e0c4386eSCy Schubert    [ "4.4.20", "Invalid Separate Certificate and CRL Keys Test20", 23 ],
99*e0c4386eSCy Schubert
100*e0c4386eSCy Schubert    # CRL path is revoked so get a CRL path validation error
101*e0c4386eSCy Schubert    [ "4.4.21", "Invalid Separate Certificate and CRL Keys Test21",      54 ],
102*e0c4386eSCy Schubert    [ "4.5",    "Verifying Paths with Self-Issued Certificates" ],
103*e0c4386eSCy Schubert    [ "4.5.1",  "Valid Basic Self-Issued Old With New Test1",            0 ],
104*e0c4386eSCy Schubert    [ "4.5.2",  "Invalid Basic Self-Issued Old With New Test2",          23 ],
105*e0c4386eSCy Schubert    [ "4.5.3",  "Valid Basic Self-Issued New With Old Test3",            0 ],
106*e0c4386eSCy Schubert    [ "4.5.4",  "Valid Basic Self-Issued New With Old Test4",            0 ],
107*e0c4386eSCy Schubert    [ "4.5.5",  "Invalid Basic Self-Issued New With Old Test5",          23 ],
108*e0c4386eSCy Schubert    [ "4.5.6",  "Valid Basic Self-Issued CRL Signing Key Test6",         0 ],
109*e0c4386eSCy Schubert    [ "4.5.7",  "Invalid Basic Self-Issued CRL Signing Key Test7",       23 ],
110*e0c4386eSCy Schubert    [ "4.5.8",  "Invalid Basic Self-Issued CRL Signing Key Test8",       20 ],
111*e0c4386eSCy Schubert    [ "4.6",    "Verifying Basic Constraints" ],
112*e0c4386eSCy Schubert    [ "4.6.1",  "Invalid Missing basicConstraints Test1",                24 ],
113*e0c4386eSCy Schubert    [ "4.6.2",  "Invalid cA False Test2",                                24 ],
114*e0c4386eSCy Schubert    [ "4.6.3",  "Invalid cA False Test3",                                24 ],
115*e0c4386eSCy Schubert    [ "4.6.4",  "Valid basicConstraints Not Critical Test4",             0 ],
116*e0c4386eSCy Schubert    [ "4.6.5",  "Invalid pathLenConstraint Test5",                       25 ],
117*e0c4386eSCy Schubert    [ "4.6.6",  "Invalid pathLenConstraint Test6",                       25 ],
118*e0c4386eSCy Schubert    [ "4.6.7",  "Valid pathLenConstraint Test7",                         0 ],
119*e0c4386eSCy Schubert    [ "4.6.8",  "Valid pathLenConstraint Test8",                         0 ],
120*e0c4386eSCy Schubert    [ "4.6.9",  "Invalid pathLenConstraint Test9",                       25 ],
121*e0c4386eSCy Schubert    [ "4.6.10", "Invalid pathLenConstraint Test10",                      25 ],
122*e0c4386eSCy Schubert    [ "4.6.11", "Invalid pathLenConstraint Test11",                      25 ],
123*e0c4386eSCy Schubert    [ "4.6.12", "Invalid pathLenConstraint Test12",                      25 ],
124*e0c4386eSCy Schubert    [ "4.6.13", "Valid pathLenConstraint Test13",                        0 ],
125*e0c4386eSCy Schubert    [ "4.6.14", "Valid pathLenConstraint Test14",                        0 ],
126*e0c4386eSCy Schubert    [ "4.6.15", "Valid Self-Issued pathLenConstraint Test15",            0 ],
127*e0c4386eSCy Schubert    [ "4.6.16", "Invalid Self-Issued pathLenConstraint Test16",          25 ],
128*e0c4386eSCy Schubert    [ "4.6.17", "Valid Self-Issued pathLenConstraint Test17",            0 ],
129*e0c4386eSCy Schubert    [ "4.7",    "Key Usage" ],
130*e0c4386eSCy Schubert    [ "4.7.1",  "Invalid keyUsage Critical keyCertSign False Test1",     20 ],
131*e0c4386eSCy Schubert    [ "4.7.2",  "Invalid keyUsage Not Critical keyCertSign False Test2", 20 ],
132*e0c4386eSCy Schubert    [ "4.7.3",  "Valid keyUsage Not Critical Test3",                     0 ],
133*e0c4386eSCy Schubert    [ "4.7.4",  "Invalid keyUsage Critical cRLSign False Test4",         35 ],
134*e0c4386eSCy Schubert    [ "4.7.5",  "Invalid keyUsage Not Critical cRLSign False Test5",     35 ],
135*e0c4386eSCy Schubert
136*e0c4386eSCy Schubert    # Certificate policy tests need special handling. They can have several
137*e0c4386eSCy Schubert    # sub tests and we need to check the outputs are correct.
138*e0c4386eSCy Schubert
139*e0c4386eSCy Schubert    [ "4.8", "Certificate Policies" ],
140*e0c4386eSCy Schubert    [
141*e0c4386eSCy Schubert        "4.8.1.1",
142*e0c4386eSCy Schubert        "All Certificates Same Policy Test1",
143*e0c4386eSCy Schubert        "-policy anyPolicy -explicit_policy",
144*e0c4386eSCy Schubert        "True", $nist1, $nist1, 0
145*e0c4386eSCy Schubert    ],
146*e0c4386eSCy Schubert    [
147*e0c4386eSCy Schubert        "4.8.1.2",
148*e0c4386eSCy Schubert        "All Certificates Same Policy Test1",
149*e0c4386eSCy Schubert        "-policy $nist1 -explicit_policy",
150*e0c4386eSCy Schubert        "True", $nist1, $nist1, 0
151*e0c4386eSCy Schubert    ],
152*e0c4386eSCy Schubert    [
153*e0c4386eSCy Schubert        "4.8.1.3",
154*e0c4386eSCy Schubert        "All Certificates Same Policy Test1",
155*e0c4386eSCy Schubert        "-policy $nist2 -explicit_policy",
156*e0c4386eSCy Schubert        "True", $nist1, "<empty>", 43
157*e0c4386eSCy Schubert    ],
158*e0c4386eSCy Schubert    [
159*e0c4386eSCy Schubert        "4.8.1.4",
160*e0c4386eSCy Schubert        "All Certificates Same Policy Test1",
161*e0c4386eSCy Schubert        "-policy $nist1 -policy $nist2 -explicit_policy",
162*e0c4386eSCy Schubert        "True", $nist1, $nist1, 0
163*e0c4386eSCy Schubert    ],
164*e0c4386eSCy Schubert    [
165*e0c4386eSCy Schubert        "4.8.2.1",
166*e0c4386eSCy Schubert        "All Certificates No Policies Test2",
167*e0c4386eSCy Schubert        "-policy anyPolicy",
168*e0c4386eSCy Schubert        "False", "<empty>", "<empty>", 0
169*e0c4386eSCy Schubert    ],
170*e0c4386eSCy Schubert    [
171*e0c4386eSCy Schubert        "4.8.2.2",
172*e0c4386eSCy Schubert        "All Certificates No Policies Test2",
173*e0c4386eSCy Schubert        "-policy anyPolicy -explicit_policy",
174*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
175*e0c4386eSCy Schubert    ],
176*e0c4386eSCy Schubert    [
177*e0c4386eSCy Schubert        "4.8.3.1",
178*e0c4386eSCy Schubert        "Different Policies Test3",
179*e0c4386eSCy Schubert        "-policy anyPolicy",
180*e0c4386eSCy Schubert        "False", "<empty>", "<empty>", 0
181*e0c4386eSCy Schubert    ],
182*e0c4386eSCy Schubert    [
183*e0c4386eSCy Schubert        "4.8.3.2",
184*e0c4386eSCy Schubert        "Different Policies Test3",
185*e0c4386eSCy Schubert        "-policy anyPolicy -explicit_policy",
186*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
187*e0c4386eSCy Schubert    ],
188*e0c4386eSCy Schubert    [
189*e0c4386eSCy Schubert        "4.8.3.3",
190*e0c4386eSCy Schubert        "Different Policies Test3",
191*e0c4386eSCy Schubert        "-policy $nist1 -policy $nist2 -explicit_policy",
192*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
193*e0c4386eSCy Schubert    ],
194*e0c4386eSCy Schubert
195*e0c4386eSCy Schubert    [
196*e0c4386eSCy Schubert        "4.8.4",
197*e0c4386eSCy Schubert        "Different Policies Test4",
198*e0c4386eSCy Schubert        "-policy anyPolicy",
199*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
200*e0c4386eSCy Schubert    ],
201*e0c4386eSCy Schubert    [
202*e0c4386eSCy Schubert        "4.8.5",
203*e0c4386eSCy Schubert        "Different Policies Test5",
204*e0c4386eSCy Schubert        "-policy anyPolicy",
205*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
206*e0c4386eSCy Schubert    ],
207*e0c4386eSCy Schubert    [
208*e0c4386eSCy Schubert        "4.8.6.1",
209*e0c4386eSCy Schubert        "Overlapping Policies Test6",
210*e0c4386eSCy Schubert        "-policy anyPolicy",
211*e0c4386eSCy Schubert        "True", $nist1, $nist1, 0
212*e0c4386eSCy Schubert    ],
213*e0c4386eSCy Schubert    [
214*e0c4386eSCy Schubert        "4.8.6.2",
215*e0c4386eSCy Schubert        "Overlapping Policies Test6",
216*e0c4386eSCy Schubert        "-policy $nist1",
217*e0c4386eSCy Schubert        "True", $nist1, $nist1, 0
218*e0c4386eSCy Schubert    ],
219*e0c4386eSCy Schubert    [
220*e0c4386eSCy Schubert        "4.8.6.3",
221*e0c4386eSCy Schubert        "Overlapping Policies Test6",
222*e0c4386eSCy Schubert        "-policy $nist2",
223*e0c4386eSCy Schubert        "True", $nist1, "<empty>", 43
224*e0c4386eSCy Schubert    ],
225*e0c4386eSCy Schubert    [
226*e0c4386eSCy Schubert        "4.8.7",
227*e0c4386eSCy Schubert        "Different Policies Test7",
228*e0c4386eSCy Schubert        "-policy anyPolicy",
229*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
230*e0c4386eSCy Schubert    ],
231*e0c4386eSCy Schubert    [
232*e0c4386eSCy Schubert        "4.8.8",
233*e0c4386eSCy Schubert        "Different Policies Test8",
234*e0c4386eSCy Schubert        "-policy anyPolicy",
235*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
236*e0c4386eSCy Schubert    ],
237*e0c4386eSCy Schubert    [
238*e0c4386eSCy Schubert        "4.8.9",
239*e0c4386eSCy Schubert        "Different Policies Test9",
240*e0c4386eSCy Schubert        "-policy anyPolicy",
241*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
242*e0c4386eSCy Schubert    ],
243*e0c4386eSCy Schubert    [
244*e0c4386eSCy Schubert        "4.8.10.1",
245*e0c4386eSCy Schubert        "All Certificates Same Policies Test10",
246*e0c4386eSCy Schubert        "-policy $nist1",
247*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist1", 0
248*e0c4386eSCy Schubert    ],
249*e0c4386eSCy Schubert    [
250*e0c4386eSCy Schubert        "4.8.10.2",
251*e0c4386eSCy Schubert        "All Certificates Same Policies Test10",
252*e0c4386eSCy Schubert        "-policy $nist2",
253*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist2", 0
254*e0c4386eSCy Schubert    ],
255*e0c4386eSCy Schubert    [
256*e0c4386eSCy Schubert        "4.8.10.3",
257*e0c4386eSCy Schubert        "All Certificates Same Policies Test10",
258*e0c4386eSCy Schubert        "-policy anyPolicy",
259*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist1:$nist2", 0
260*e0c4386eSCy Schubert    ],
261*e0c4386eSCy Schubert    [
262*e0c4386eSCy Schubert        "4.8.11.1",
263*e0c4386eSCy Schubert        "All Certificates AnyPolicy Test11",
264*e0c4386eSCy Schubert        "-policy anyPolicy",
265*e0c4386eSCy Schubert        "True", "$apolicy", "$apolicy", 0
266*e0c4386eSCy Schubert    ],
267*e0c4386eSCy Schubert    [
268*e0c4386eSCy Schubert        "4.8.11.2",
269*e0c4386eSCy Schubert        "All Certificates AnyPolicy Test11",
270*e0c4386eSCy Schubert        "-policy $nist1",
271*e0c4386eSCy Schubert        "True", "$apolicy", "$nist1", 0
272*e0c4386eSCy Schubert    ],
273*e0c4386eSCy Schubert    [
274*e0c4386eSCy Schubert        "4.8.12",
275*e0c4386eSCy Schubert        "Different Policies Test12",
276*e0c4386eSCy Schubert        "-policy anyPolicy",
277*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
278*e0c4386eSCy Schubert    ],
279*e0c4386eSCy Schubert    [
280*e0c4386eSCy Schubert        "4.8.13.1",
281*e0c4386eSCy Schubert        "All Certificates Same Policies Test13",
282*e0c4386eSCy Schubert        "-policy $nist1",
283*e0c4386eSCy Schubert        "True", "$nist1:$nist2:$nist3", "$nist1", 0
284*e0c4386eSCy Schubert    ],
285*e0c4386eSCy Schubert    [
286*e0c4386eSCy Schubert        "4.8.13.2",
287*e0c4386eSCy Schubert        "All Certificates Same Policies Test13",
288*e0c4386eSCy Schubert        "-policy $nist2",
289*e0c4386eSCy Schubert        "True", "$nist1:$nist2:$nist3", "$nist2", 0
290*e0c4386eSCy Schubert    ],
291*e0c4386eSCy Schubert    [
292*e0c4386eSCy Schubert        "4.8.13.3",
293*e0c4386eSCy Schubert        "All Certificates Same Policies Test13",
294*e0c4386eSCy Schubert        "-policy $nist3",
295*e0c4386eSCy Schubert        "True", "$nist1:$nist2:$nist3", "$nist3", 0
296*e0c4386eSCy Schubert    ],
297*e0c4386eSCy Schubert    [
298*e0c4386eSCy Schubert        "4.8.14.1",       "AnyPolicy Test14",
299*e0c4386eSCy Schubert        "-policy $nist1", "True",
300*e0c4386eSCy Schubert        "$nist1",         "$nist1",
301*e0c4386eSCy Schubert        0
302*e0c4386eSCy Schubert    ],
303*e0c4386eSCy Schubert    [
304*e0c4386eSCy Schubert        "4.8.14.2",       "AnyPolicy Test14",
305*e0c4386eSCy Schubert        "-policy $nist2", "True",
306*e0c4386eSCy Schubert        "$nist1",         "<empty>",
307*e0c4386eSCy Schubert        43
308*e0c4386eSCy Schubert    ],
309*e0c4386eSCy Schubert    [
310*e0c4386eSCy Schubert        "4.8.15",
311*e0c4386eSCy Schubert        "User Notice Qualifier Test15",
312*e0c4386eSCy Schubert        "-policy anyPolicy",
313*e0c4386eSCy Schubert        "False", "$nist1", "$nist1", 0
314*e0c4386eSCy Schubert    ],
315*e0c4386eSCy Schubert    [
316*e0c4386eSCy Schubert        "4.8.16",
317*e0c4386eSCy Schubert        "User Notice Qualifier Test16",
318*e0c4386eSCy Schubert        "-policy anyPolicy",
319*e0c4386eSCy Schubert        "False", "$nist1", "$nist1", 0
320*e0c4386eSCy Schubert    ],
321*e0c4386eSCy Schubert    [
322*e0c4386eSCy Schubert        "4.8.17",
323*e0c4386eSCy Schubert        "User Notice Qualifier Test17",
324*e0c4386eSCy Schubert        "-policy anyPolicy",
325*e0c4386eSCy Schubert        "False", "$nist1", "$nist1", 0
326*e0c4386eSCy Schubert    ],
327*e0c4386eSCy Schubert    [
328*e0c4386eSCy Schubert        "4.8.18.1",
329*e0c4386eSCy Schubert        "User Notice Qualifier Test18",
330*e0c4386eSCy Schubert        "-policy $nist1",
331*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist1", 0
332*e0c4386eSCy Schubert    ],
333*e0c4386eSCy Schubert    [
334*e0c4386eSCy Schubert        "4.8.18.2",
335*e0c4386eSCy Schubert        "User Notice Qualifier Test18",
336*e0c4386eSCy Schubert        "-policy $nist2",
337*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist2", 0
338*e0c4386eSCy Schubert    ],
339*e0c4386eSCy Schubert    [
340*e0c4386eSCy Schubert        "4.8.19",
341*e0c4386eSCy Schubert        "User Notice Qualifier Test19",
342*e0c4386eSCy Schubert        "-policy anyPolicy",
343*e0c4386eSCy Schubert        "False", "$nist1", "$nist1", 0
344*e0c4386eSCy Schubert    ],
345*e0c4386eSCy Schubert    [
346*e0c4386eSCy Schubert        "4.8.20",
347*e0c4386eSCy Schubert        "CPS Pointer Qualifier Test20",
348*e0c4386eSCy Schubert        "-policy anyPolicy -explicit_policy",
349*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
350*e0c4386eSCy Schubert    ],
351*e0c4386eSCy Schubert    [ "4.9", "Require Explicit Policy" ],
352*e0c4386eSCy Schubert    [
353*e0c4386eSCy Schubert        "4.9.1",
354*e0c4386eSCy Schubert        "Valid RequireExplicitPolicy Test1",
355*e0c4386eSCy Schubert        "-policy anyPolicy",
356*e0c4386eSCy Schubert        "False", "<empty>", "<empty>", 0
357*e0c4386eSCy Schubert    ],
358*e0c4386eSCy Schubert    [
359*e0c4386eSCy Schubert        "4.9.2",
360*e0c4386eSCy Schubert        "Valid RequireExplicitPolicy Test2",
361*e0c4386eSCy Schubert        "-policy anyPolicy",
362*e0c4386eSCy Schubert        "False", "<empty>", "<empty>", 0
363*e0c4386eSCy Schubert    ],
364*e0c4386eSCy Schubert    [
365*e0c4386eSCy Schubert        "4.9.3",
366*e0c4386eSCy Schubert        "Invalid RequireExplicitPolicy Test3",
367*e0c4386eSCy Schubert        "-policy anyPolicy",
368*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
369*e0c4386eSCy Schubert    ],
370*e0c4386eSCy Schubert    [
371*e0c4386eSCy Schubert        "4.9.4",
372*e0c4386eSCy Schubert        "Valid RequireExplicitPolicy Test4",
373*e0c4386eSCy Schubert        "-policy anyPolicy",
374*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
375*e0c4386eSCy Schubert    ],
376*e0c4386eSCy Schubert    [
377*e0c4386eSCy Schubert        "4.9.5",
378*e0c4386eSCy Schubert        "Invalid RequireExplicitPolicy Test5",
379*e0c4386eSCy Schubert        "-policy anyPolicy",
380*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
381*e0c4386eSCy Schubert    ],
382*e0c4386eSCy Schubert    [
383*e0c4386eSCy Schubert        "4.9.6",
384*e0c4386eSCy Schubert        "Valid Self-Issued requireExplicitPolicy Test6",
385*e0c4386eSCy Schubert        "-policy anyPolicy",
386*e0c4386eSCy Schubert        "False", "<empty>", "<empty>", 0
387*e0c4386eSCy Schubert    ],
388*e0c4386eSCy Schubert    [
389*e0c4386eSCy Schubert        "4.9.7",
390*e0c4386eSCy Schubert        "Invalid Self-Issued requireExplicitPolicy Test7",
391*e0c4386eSCy Schubert        "-policy anyPolicy",
392*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
393*e0c4386eSCy Schubert    ],
394*e0c4386eSCy Schubert    [
395*e0c4386eSCy Schubert        "4.9.8",
396*e0c4386eSCy Schubert        "Invalid Self-Issued requireExplicitPolicy Test8",
397*e0c4386eSCy Schubert        "-policy anyPolicy",
398*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
399*e0c4386eSCy Schubert    ],
400*e0c4386eSCy Schubert    [ "4.10", "Policy Mappings" ],
401*e0c4386eSCy Schubert    [
402*e0c4386eSCy Schubert        "4.10.1.1",
403*e0c4386eSCy Schubert        "Valid Policy Mapping Test1",
404*e0c4386eSCy Schubert        "-policy $nist1",
405*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
406*e0c4386eSCy Schubert    ],
407*e0c4386eSCy Schubert    [
408*e0c4386eSCy Schubert        "4.10.1.2",
409*e0c4386eSCy Schubert        "Valid Policy Mapping Test1",
410*e0c4386eSCy Schubert        "-policy $nist2",
411*e0c4386eSCy Schubert        "True", "$nist1", "<empty>", 43
412*e0c4386eSCy Schubert    ],
413*e0c4386eSCy Schubert    [
414*e0c4386eSCy Schubert        "4.10.1.3",
415*e0c4386eSCy Schubert        "Valid Policy Mapping Test1",
416*e0c4386eSCy Schubert        "-policy anyPolicy -inhibit_map",
417*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
418*e0c4386eSCy Schubert    ],
419*e0c4386eSCy Schubert    [
420*e0c4386eSCy Schubert        "4.10.2.1",
421*e0c4386eSCy Schubert        "Invalid Policy Mapping Test2",
422*e0c4386eSCy Schubert        "-policy anyPolicy",
423*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
424*e0c4386eSCy Schubert    ],
425*e0c4386eSCy Schubert    [
426*e0c4386eSCy Schubert        "4.10.2.2",
427*e0c4386eSCy Schubert        "Invalid Policy Mapping Test2",
428*e0c4386eSCy Schubert        "-policy anyPolicy -inhibit_map",
429*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
430*e0c4386eSCy Schubert    ],
431*e0c4386eSCy Schubert    [
432*e0c4386eSCy Schubert        "4.10.3.1",
433*e0c4386eSCy Schubert        "Valid Policy Mapping Test3",
434*e0c4386eSCy Schubert        "-policy $nist1",
435*e0c4386eSCy Schubert        "True", "$nist2", "<empty>", 43
436*e0c4386eSCy Schubert    ],
437*e0c4386eSCy Schubert    [
438*e0c4386eSCy Schubert        "4.10.3.2",
439*e0c4386eSCy Schubert        "Valid Policy Mapping Test3",
440*e0c4386eSCy Schubert        "-policy $nist2",
441*e0c4386eSCy Schubert        "True", "$nist2", "$nist2", 0
442*e0c4386eSCy Schubert    ],
443*e0c4386eSCy Schubert    [
444*e0c4386eSCy Schubert        "4.10.4",
445*e0c4386eSCy Schubert        "Invalid Policy Mapping Test4",
446*e0c4386eSCy Schubert        "-policy anyPolicy",
447*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
448*e0c4386eSCy Schubert    ],
449*e0c4386eSCy Schubert    [
450*e0c4386eSCy Schubert        "4.10.5.1",
451*e0c4386eSCy Schubert        "Valid Policy Mapping Test5",
452*e0c4386eSCy Schubert        "-policy $nist1",
453*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
454*e0c4386eSCy Schubert    ],
455*e0c4386eSCy Schubert    [
456*e0c4386eSCy Schubert        "4.10.5.2",
457*e0c4386eSCy Schubert        "Valid Policy Mapping Test5",
458*e0c4386eSCy Schubert        "-policy $nist6",
459*e0c4386eSCy Schubert        "True", "$nist1", "<empty>", 43
460*e0c4386eSCy Schubert    ],
461*e0c4386eSCy Schubert    [
462*e0c4386eSCy Schubert        "4.10.6.1",
463*e0c4386eSCy Schubert        "Valid Policy Mapping Test6",
464*e0c4386eSCy Schubert        "-policy $nist1",
465*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
466*e0c4386eSCy Schubert    ],
467*e0c4386eSCy Schubert    [
468*e0c4386eSCy Schubert        "4.10.6.2",
469*e0c4386eSCy Schubert        "Valid Policy Mapping Test6",
470*e0c4386eSCy Schubert        "-policy $nist6",
471*e0c4386eSCy Schubert        "True", "$nist1", "<empty>", 43
472*e0c4386eSCy Schubert    ],
473*e0c4386eSCy Schubert    [ "4.10.7", "Invalid Mapping From anyPolicy Test7", 42 ],
474*e0c4386eSCy Schubert    [ "4.10.8", "Invalid Mapping To anyPolicy Test8",   42 ],
475*e0c4386eSCy Schubert    [
476*e0c4386eSCy Schubert        "4.10.9",
477*e0c4386eSCy Schubert        "Valid Policy Mapping Test9",
478*e0c4386eSCy Schubert        "-policy anyPolicy",
479*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
480*e0c4386eSCy Schubert    ],
481*e0c4386eSCy Schubert    [
482*e0c4386eSCy Schubert        "4.10.10",
483*e0c4386eSCy Schubert        "Invalid Policy Mapping Test10",
484*e0c4386eSCy Schubert        "-policy anyPolicy",
485*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
486*e0c4386eSCy Schubert    ],
487*e0c4386eSCy Schubert    [
488*e0c4386eSCy Schubert        "4.10.11",
489*e0c4386eSCy Schubert        "Valid Policy Mapping Test11",
490*e0c4386eSCy Schubert        "-policy anyPolicy",
491*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
492*e0c4386eSCy Schubert    ],
493*e0c4386eSCy Schubert
494*e0c4386eSCy Schubert    # TODO: check notice display
495*e0c4386eSCy Schubert    [
496*e0c4386eSCy Schubert        "4.10.12.1",
497*e0c4386eSCy Schubert        "Valid Policy Mapping Test12",
498*e0c4386eSCy Schubert        "-policy $nist1",
499*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist1", 0
500*e0c4386eSCy Schubert    ],
501*e0c4386eSCy Schubert
502*e0c4386eSCy Schubert    # TODO: check notice display
503*e0c4386eSCy Schubert    [
504*e0c4386eSCy Schubert        "4.10.12.2",
505*e0c4386eSCy Schubert        "Valid Policy Mapping Test12",
506*e0c4386eSCy Schubert        "-policy $nist2",
507*e0c4386eSCy Schubert        "True", "$nist1:$nist2", "$nist2", 0
508*e0c4386eSCy Schubert    ],
509*e0c4386eSCy Schubert    [
510*e0c4386eSCy Schubert        "4.10.13",
511*e0c4386eSCy Schubert        "Valid Policy Mapping Test13",
512*e0c4386eSCy Schubert        "-policy anyPolicy",
513*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
514*e0c4386eSCy Schubert    ],
515*e0c4386eSCy Schubert
516*e0c4386eSCy Schubert    # TODO: check notice display
517*e0c4386eSCy Schubert    [
518*e0c4386eSCy Schubert        "4.10.14",
519*e0c4386eSCy Schubert        "Valid Policy Mapping Test14",
520*e0c4386eSCy Schubert        "-policy anyPolicy",
521*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
522*e0c4386eSCy Schubert    ],
523*e0c4386eSCy Schubert    [ "4.11", "Inhibit Policy Mapping" ],
524*e0c4386eSCy Schubert    [
525*e0c4386eSCy Schubert        "4.11.1",
526*e0c4386eSCy Schubert        "Invalid inhibitPolicyMapping Test1",
527*e0c4386eSCy Schubert        "-policy anyPolicy",
528*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
529*e0c4386eSCy Schubert    ],
530*e0c4386eSCy Schubert    [
531*e0c4386eSCy Schubert        "4.11.2",
532*e0c4386eSCy Schubert        "Valid inhibitPolicyMapping Test2",
533*e0c4386eSCy Schubert        "-policy anyPolicy",
534*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
535*e0c4386eSCy Schubert    ],
536*e0c4386eSCy Schubert    [
537*e0c4386eSCy Schubert        "4.11.3",
538*e0c4386eSCy Schubert        "Invalid inhibitPolicyMapping Test3",
539*e0c4386eSCy Schubert        "-policy anyPolicy",
540*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
541*e0c4386eSCy Schubert    ],
542*e0c4386eSCy Schubert    [
543*e0c4386eSCy Schubert        "4.11.4",
544*e0c4386eSCy Schubert        "Valid inhibitPolicyMapping Test4",
545*e0c4386eSCy Schubert        "-policy anyPolicy",
546*e0c4386eSCy Schubert        "True", "$nist2", "$nist2", 0
547*e0c4386eSCy Schubert    ],
548*e0c4386eSCy Schubert    [
549*e0c4386eSCy Schubert        "4.11.5",
550*e0c4386eSCy Schubert        "Invalid inhibitPolicyMapping Test5",
551*e0c4386eSCy Schubert        "-policy anyPolicy",
552*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
553*e0c4386eSCy Schubert    ],
554*e0c4386eSCy Schubert    [
555*e0c4386eSCy Schubert        "4.11.6",
556*e0c4386eSCy Schubert        "Invalid inhibitPolicyMapping Test6",
557*e0c4386eSCy Schubert        "-policy anyPolicy",
558*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
559*e0c4386eSCy Schubert    ],
560*e0c4386eSCy Schubert    [
561*e0c4386eSCy Schubert        "4.11.7",
562*e0c4386eSCy Schubert        "Valid Self-Issued inhibitPolicyMapping Test7",
563*e0c4386eSCy Schubert        "-policy anyPolicy",
564*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
565*e0c4386eSCy Schubert    ],
566*e0c4386eSCy Schubert    [
567*e0c4386eSCy Schubert        "4.11.8",
568*e0c4386eSCy Schubert        "Invalid Self-Issued inhibitPolicyMapping Test8",
569*e0c4386eSCy Schubert        "-policy anyPolicy",
570*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
571*e0c4386eSCy Schubert    ],
572*e0c4386eSCy Schubert    [
573*e0c4386eSCy Schubert        "4.11.9",
574*e0c4386eSCy Schubert        "Invalid Self-Issued inhibitPolicyMapping Test9",
575*e0c4386eSCy Schubert        "-policy anyPolicy",
576*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
577*e0c4386eSCy Schubert    ],
578*e0c4386eSCy Schubert    [
579*e0c4386eSCy Schubert        "4.11.10",
580*e0c4386eSCy Schubert        "Invalid Self-Issued inhibitPolicyMapping Test10",
581*e0c4386eSCy Schubert        "-policy anyPolicy",
582*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
583*e0c4386eSCy Schubert    ],
584*e0c4386eSCy Schubert    [
585*e0c4386eSCy Schubert        "4.11.11",
586*e0c4386eSCy Schubert        "Invalid Self-Issued inhibitPolicyMapping Test11",
587*e0c4386eSCy Schubert        "-policy anyPolicy",
588*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
589*e0c4386eSCy Schubert    ],
590*e0c4386eSCy Schubert    [ "4.12", "Inhibit Any Policy" ],
591*e0c4386eSCy Schubert    [
592*e0c4386eSCy Schubert        "4.12.1",
593*e0c4386eSCy Schubert        "Invalid inhibitAnyPolicy Test1",
594*e0c4386eSCy Schubert        "-policy anyPolicy",
595*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
596*e0c4386eSCy Schubert    ],
597*e0c4386eSCy Schubert    [
598*e0c4386eSCy Schubert        "4.12.2",
599*e0c4386eSCy Schubert        "Valid inhibitAnyPolicy Test2",
600*e0c4386eSCy Schubert        "-policy anyPolicy",
601*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
602*e0c4386eSCy Schubert    ],
603*e0c4386eSCy Schubert    [
604*e0c4386eSCy Schubert        "4.12.3.1",
605*e0c4386eSCy Schubert        "inhibitAnyPolicy Test3",
606*e0c4386eSCy Schubert        "-policy anyPolicy",
607*e0c4386eSCy Schubert        "True", "$nist1", "$nist1", 0
608*e0c4386eSCy Schubert    ],
609*e0c4386eSCy Schubert    [
610*e0c4386eSCy Schubert        "4.12.3.2",
611*e0c4386eSCy Schubert        "inhibitAnyPolicy Test3",
612*e0c4386eSCy Schubert        "-policy anyPolicy -inhibit_any",
613*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
614*e0c4386eSCy Schubert    ],
615*e0c4386eSCy Schubert    [
616*e0c4386eSCy Schubert        "4.12.4",
617*e0c4386eSCy Schubert        "Invalid inhibitAnyPolicy Test4",
618*e0c4386eSCy Schubert        "-policy anyPolicy",
619*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
620*e0c4386eSCy Schubert    ],
621*e0c4386eSCy Schubert    [
622*e0c4386eSCy Schubert        "4.12.5",
623*e0c4386eSCy Schubert        "Invalid inhibitAnyPolicy Test5",
624*e0c4386eSCy Schubert        "-policy anyPolicy",
625*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
626*e0c4386eSCy Schubert    ],
627*e0c4386eSCy Schubert    [
628*e0c4386eSCy Schubert        "4.12.6",
629*e0c4386eSCy Schubert        "Invalid inhibitAnyPolicy Test6",
630*e0c4386eSCy Schubert        "-policy anyPolicy",
631*e0c4386eSCy Schubert        "True", "<empty>", "<empty>", 43
632*e0c4386eSCy Schubert    ],
633*e0c4386eSCy Schubert    [ "4.12.7",  "Valid Self-Issued inhibitAnyPolicy Test7",      0 ],
634*e0c4386eSCy Schubert    [ "4.12.8",  "Invalid Self-Issued inhibitAnyPolicy Test8",    43 ],
635*e0c4386eSCy Schubert    [ "4.12.9",  "Valid Self-Issued inhibitAnyPolicy Test9",      0 ],
636*e0c4386eSCy Schubert    [ "4.12.10", "Invalid Self-Issued inhibitAnyPolicy Test10",   43 ],
637*e0c4386eSCy Schubert    [ "4.13",    "Name Constraints" ],
638*e0c4386eSCy Schubert    [ "4.13.1",  "Valid DN nameConstraints Test1",                0 ],
639*e0c4386eSCy Schubert    [ "4.13.2",  "Invalid DN nameConstraints Test2",              47 ],
640*e0c4386eSCy Schubert    [ "4.13.3",  "Invalid DN nameConstraints Test3",              47 ],
641*e0c4386eSCy Schubert    [ "4.13.4",  "Valid DN nameConstraints Test4",                0 ],
642*e0c4386eSCy Schubert    [ "4.13.5",  "Valid DN nameConstraints Test5",                0 ],
643*e0c4386eSCy Schubert    [ "4.13.6",  "Valid DN nameConstraints Test6",                0 ],
644*e0c4386eSCy Schubert    [ "4.13.7",  "Invalid DN nameConstraints Test7",              48 ],
645*e0c4386eSCy Schubert    [ "4.13.8",  "Invalid DN nameConstraints Test8",              48 ],
646*e0c4386eSCy Schubert    [ "4.13.9",  "Invalid DN nameConstraints Test9",              48 ],
647*e0c4386eSCy Schubert    [ "4.13.10", "Invalid DN nameConstraints Test10",             48 ],
648*e0c4386eSCy Schubert    [ "4.13.11", "Valid DN nameConstraints Test11",               0 ],
649*e0c4386eSCy Schubert    [ "4.13.12", "Invalid DN nameConstraints Test12",             47 ],
650*e0c4386eSCy Schubert    [ "4.13.13", "Invalid DN nameConstraints Test13",             47 ],
651*e0c4386eSCy Schubert    [ "4.13.14", "Valid DN nameConstraints Test14",               0 ],
652*e0c4386eSCy Schubert    [ "4.13.15", "Invalid DN nameConstraints Test15",             48 ],
653*e0c4386eSCy Schubert    [ "4.13.16", "Invalid DN nameConstraints Test16",             48 ],
654*e0c4386eSCy Schubert    [ "4.13.17", "Invalid DN nameConstraints Test17",             48 ],
655*e0c4386eSCy Schubert    [ "4.13.18", "Valid DN nameConstraints Test18",               0 ],
656*e0c4386eSCy Schubert    [ "4.13.19", "Valid Self-Issued DN nameConstraints Test19",   0 ],
657*e0c4386eSCy Schubert    [ "4.13.20", "Invalid Self-Issued DN nameConstraints Test20", 47 ],
658*e0c4386eSCy Schubert    [ "4.13.21", "Valid RFC822 nameConstraints Test21",           0 ],
659*e0c4386eSCy Schubert    [ "4.13.22", "Invalid RFC822 nameConstraints Test22",         47 ],
660*e0c4386eSCy Schubert    [ "4.13.23", "Valid RFC822 nameConstraints Test23",           0 ],
661*e0c4386eSCy Schubert    [ "4.13.24", "Invalid RFC822 nameConstraints Test24",         47 ],
662*e0c4386eSCy Schubert    [ "4.13.25", "Valid RFC822 nameConstraints Test25",           0 ],
663*e0c4386eSCy Schubert    [ "4.13.26", "Invalid RFC822 nameConstraints Test26",         48 ],
664*e0c4386eSCy Schubert    [ "4.13.27", "Valid DN and RFC822 nameConstraints Test27",    0 ],
665*e0c4386eSCy Schubert    [ "4.13.28", "Invalid DN and RFC822 nameConstraints Test28",  47 ],
666*e0c4386eSCy Schubert    [ "4.13.29", "Invalid DN and RFC822 nameConstraints Test29",  47 ],
667*e0c4386eSCy Schubert    [ "4.13.30", "Valid DNS nameConstraints Test30",              0 ],
668*e0c4386eSCy Schubert    [ "4.13.31", "Invalid DNS nameConstraints Test31",            47 ],
669*e0c4386eSCy Schubert    [ "4.13.32", "Valid DNS nameConstraints Test32",              0 ],
670*e0c4386eSCy Schubert    [ "4.13.33", "Invalid DNS nameConstraints Test33",            48 ],
671*e0c4386eSCy Schubert    [ "4.13.34", "Valid URI nameConstraints Test34",              0 ],
672*e0c4386eSCy Schubert    [ "4.13.35", "Invalid URI nameConstraints Test35",            47 ],
673*e0c4386eSCy Schubert    [ "4.13.36", "Valid URI nameConstraints Test36",              0 ],
674*e0c4386eSCy Schubert    [ "4.13.37", "Invalid URI nameConstraints Test37",            48 ],
675*e0c4386eSCy Schubert    [ "4.13.38", "Invalid DNS nameConstraints Test38",            47 ],
676*e0c4386eSCy Schubert    [ "4.14",    "Distribution Points" ],
677*e0c4386eSCy Schubert    [ "4.14.1",  "Valid distributionPoint Test1",                 0 ],
678*e0c4386eSCy Schubert    [ "4.14.2",  "Invalid distributionPoint Test2",               23 ],
679*e0c4386eSCy Schubert    [ "4.14.3",  "Invalid distributionPoint Test3",               44 ],
680*e0c4386eSCy Schubert    [ "4.14.4",  "Valid distributionPoint Test4",                 0 ],
681*e0c4386eSCy Schubert    [ "4.14.5",  "Valid distributionPoint Test5",                 0 ],
682*e0c4386eSCy Schubert    [ "4.14.6",  "Invalid distributionPoint Test6",               23 ],
683*e0c4386eSCy Schubert    [ "4.14.7",  "Valid distributionPoint Test7",                 0 ],
684*e0c4386eSCy Schubert    [ "4.14.8",  "Invalid distributionPoint Test8",               44 ],
685*e0c4386eSCy Schubert    [ "4.14.9",  "Invalid distributionPoint Test9",               44 ],
686*e0c4386eSCy Schubert    [ "4.14.10", "Valid No issuingDistributionPoint Test10",      0 ],
687*e0c4386eSCy Schubert    [ "4.14.11", "Invalid onlyContainsUserCerts CRL Test11",      44 ],
688*e0c4386eSCy Schubert    [ "4.14.12", "Invalid onlyContainsCACerts CRL Test12",        44 ],
689*e0c4386eSCy Schubert    [ "4.14.13", "Valid onlyContainsCACerts CRL Test13",          0 ],
690*e0c4386eSCy Schubert    [ "4.14.14", "Invalid onlyContainsAttributeCerts Test14",     44 ],
691*e0c4386eSCy Schubert    [ "4.14.15", "Invalid onlySomeReasons Test15",                23 ],
692*e0c4386eSCy Schubert    [ "4.14.16", "Invalid onlySomeReasons Test16",                23 ],
693*e0c4386eSCy Schubert    [ "4.14.17", "Invalid onlySomeReasons Test17",                3 ],
694*e0c4386eSCy Schubert    [ "4.14.18", "Valid onlySomeReasons Test18",                  0 ],
695*e0c4386eSCy Schubert    [ "4.14.19", "Valid onlySomeReasons Test19",                  0 ],
696*e0c4386eSCy Schubert    [ "4.14.20", "Invalid onlySomeReasons Test20",                23 ],
697*e0c4386eSCy Schubert    [ "4.14.21", "Invalid onlySomeReasons Test21",                23 ],
698*e0c4386eSCy Schubert    [ "4.14.22", "Valid IDP with indirectCRL Test22",             0 ],
699*e0c4386eSCy Schubert    [ "4.14.23", "Invalid IDP with indirectCRL Test23",           23 ],
700*e0c4386eSCy Schubert    [ "4.14.24", "Valid IDP with indirectCRL Test24",             0 ],
701*e0c4386eSCy Schubert    [ "4.14.25", "Valid IDP with indirectCRL Test25",             0 ],
702*e0c4386eSCy Schubert    [ "4.14.26", "Invalid IDP with indirectCRL Test26",           44 ],
703*e0c4386eSCy Schubert    [ "4.14.27", "Invalid cRLIssuer Test27",                      3 ],
704*e0c4386eSCy Schubert    [ "4.14.28", "Valid cRLIssuer Test28",                        0 ],
705*e0c4386eSCy Schubert    [ "4.14.29", "Valid cRLIssuer Test29",                        0 ],
706*e0c4386eSCy Schubert
707*e0c4386eSCy Schubert    # Although this test is valid it has a circular dependency. As a result
708*e0c4386eSCy Schubert    # an attempt is made to recursively checks a CRL path and rejected due to
709*e0c4386eSCy Schubert    # a CRL path validation error. PKITS notes suggest this test does not
710*e0c4386eSCy Schubert    # need to be run due to this issue.
711*e0c4386eSCy Schubert    [ "4.14.30", "Valid cRLIssuer Test30",                                 54 ],
712*e0c4386eSCy Schubert    [ "4.14.31", "Invalid cRLIssuer Test31",                               23 ],
713*e0c4386eSCy Schubert    [ "4.14.32", "Invalid cRLIssuer Test32",                               23 ],
714*e0c4386eSCy Schubert    [ "4.14.33", "Valid cRLIssuer Test33",                                 0 ],
715*e0c4386eSCy Schubert    [ "4.14.34", "Invalid cRLIssuer Test34",                               23 ],
716*e0c4386eSCy Schubert    [ "4.14.35", "Invalid cRLIssuer Test35",                               44 ],
717*e0c4386eSCy Schubert    [ "4.15",    "Delta-CRLs" ],
718*e0c4386eSCy Schubert    [ "4.15.1",  "Invalid deltaCRLIndicator No Base Test1",                3 ],
719*e0c4386eSCy Schubert    [ "4.15.2",  "Valid delta-CRL Test2",                                  0 ],
720*e0c4386eSCy Schubert    [ "4.15.3",  "Invalid delta-CRL Test3",                                23 ],
721*e0c4386eSCy Schubert    [ "4.15.4",  "Invalid delta-CRL Test4",                                23 ],
722*e0c4386eSCy Schubert    [ "4.15.5",  "Valid delta-CRL Test5",                                  0 ],
723*e0c4386eSCy Schubert    [ "4.15.6",  "Invalid delta-CRL Test6",                                23 ],
724*e0c4386eSCy Schubert    [ "4.15.7",  "Valid delta-CRL Test7",                                  0 ],
725*e0c4386eSCy Schubert    [ "4.15.8",  "Valid delta-CRL Test8",                                  0 ],
726*e0c4386eSCy Schubert    [ "4.15.9",  "Invalid delta-CRL Test9",                                23 ],
727*e0c4386eSCy Schubert    [ "4.15.10", "Invalid delta-CRL Test10",                               12 ],
728*e0c4386eSCy Schubert    [ "4.16",    "Private Certificate Extensions" ],
729*e0c4386eSCy Schubert    [ "4.16.1",  "Valid Unknown Not Critical Certificate Extension Test1", 0 ],
730*e0c4386eSCy Schubert    [ "4.16.2",  "Invalid Unknown Critical Certificate Extension Test2",   34 ],
731*e0c4386eSCy Schubert);
732*e0c4386eSCy Schubert
733*e0c4386eSCy Schubert
734*e0c4386eSCy Schubertmy $verbose = 1;
735*e0c4386eSCy Schubert
736*e0c4386eSCy Schubertmy $numtest = 0;
737*e0c4386eSCy Schubertmy $numfail = 0;
738*e0c4386eSCy Schubert
739*e0c4386eSCy Schubertmy $ossl = "ossl/apps/openssl";
740*e0c4386eSCy Schubert
741*e0c4386eSCy Schubertmy $ossl_cmd = "$ossl_path cms -verify -verify_retcode ";
742*e0c4386eSCy Schubert$ossl_cmd .= "-CAfile pkitsta.pem -crl_check_all -x509_strict ";
743*e0c4386eSCy Schubert
744*e0c4386eSCy Schubert# Check for expiry of trust anchor
745*e0c4386eSCy Schubertsystem "$ossl_path x509 -inform DER -in $pkitsta -checkend 0";
746*e0c4386eSCy Schubertif ($? == 256)
747*e0c4386eSCy Schubert	{
748*e0c4386eSCy Schubert	print STDERR "WARNING: using older expired data\n";
749*e0c4386eSCy Schubert	$ossl_cmd .= "-attime 1291940972 ";
750*e0c4386eSCy Schubert	}
751*e0c4386eSCy Schubert
752*e0c4386eSCy Schubert$ossl_cmd .= "-policy_check -extended_crl -use_deltas -out /dev/null 2>&1 ";
753*e0c4386eSCy Schubert
754*e0c4386eSCy Schubertsystem "$ossl_path x509 -inform DER -in $pkitsta -out pkitsta.pem";
755*e0c4386eSCy Schubert
756*e0c4386eSCy Schubertdie "Can't create trust anchor file" if $?;
757*e0c4386eSCy Schubert
758*e0c4386eSCy Schubertprint "Running PKITS tests:\n" if $verbose;
759*e0c4386eSCy Schubert
760*e0c4386eSCy Schubertforeach (@testlists) {
761*e0c4386eSCy Schubert    my $argnum = @$_;
762*e0c4386eSCy Schubert    if ( $argnum == 2 ) {
763*e0c4386eSCy Schubert        my ( $tnum, $title ) = @$_;
764*e0c4386eSCy Schubert        print "$tnum $title\n" if $verbose;
765*e0c4386eSCy Schubert    }
766*e0c4386eSCy Schubert    elsif ( $argnum == 3 ) {
767*e0c4386eSCy Schubert        my ( $tnum, $title, $exp_ret ) = @$_;
768*e0c4386eSCy Schubert        my $filename = $title;
769*e0c4386eSCy Schubert        $exp_ret += 32 if $exp_ret;
770*e0c4386eSCy Schubert        $filename =~ tr/ -//d;
771*e0c4386eSCy Schubert        $filename = "Signed${filename}.eml";
772*e0c4386eSCy Schubert        if ( !-f "$pkitsdir/$filename" ) {
773*e0c4386eSCy Schubert            print "\"$filename\" not found\n";
774*e0c4386eSCy Schubert        }
775*e0c4386eSCy Schubert        else {
776*e0c4386eSCy Schubert            my $ret;
777*e0c4386eSCy Schubert            my $test_fail = 0;
778*e0c4386eSCy Schubert            my $errmsg    = "";
779*e0c4386eSCy Schubert            my $cmd       = $ossl_cmd;
780*e0c4386eSCy Schubert            $cmd .= "-in $pkitsdir/$filename -policy anyPolicy";
781*e0c4386eSCy Schubert            my $cmdout = `$cmd`;
782*e0c4386eSCy Schubert            $ret = $? >> 8;
783*e0c4386eSCy Schubert            if ( $? & 0xff ) {
784*e0c4386eSCy Schubert                $errmsg .= "Abnormal OpenSSL termination\n";
785*e0c4386eSCy Schubert                $test_fail = 1;
786*e0c4386eSCy Schubert            }
787*e0c4386eSCy Schubert            if ( $exp_ret != $ret ) {
788*e0c4386eSCy Schubert                $errmsg .= "Return code:$ret, ";
789*e0c4386eSCy Schubert                $errmsg .= "expected $exp_ret\n";
790*e0c4386eSCy Schubert                $test_fail = 1;
791*e0c4386eSCy Schubert            }
792*e0c4386eSCy Schubert            if ($test_fail) {
793*e0c4386eSCy Schubert                print "$tnum $title : Failed!\n";
794*e0c4386eSCy Schubert                print "Filename: $pkitsdir/$filename\n";
795*e0c4386eSCy Schubert                print $errmsg;
796*e0c4386eSCy Schubert                print "Command output:\n$cmdout\n";
797*e0c4386eSCy Schubert                $numfail++;
798*e0c4386eSCy Schubert            }
799*e0c4386eSCy Schubert            $numtest++;
800*e0c4386eSCy Schubert        }
801*e0c4386eSCy Schubert    }
802*e0c4386eSCy Schubert    elsif ( $argnum == 7 ) {
803*e0c4386eSCy Schubert        my ( $tnum, $title, $exargs, $exp_epol, $exp_aset, $exp_uset, $exp_ret )
804*e0c4386eSCy Schubert          = @$_;
805*e0c4386eSCy Schubert        my $filename = $title;
806*e0c4386eSCy Schubert        $exp_ret += 32 if $exp_ret;
807*e0c4386eSCy Schubert        $filename =~ tr/ -//d;
808*e0c4386eSCy Schubert        $filename = "Signed${filename}.eml";
809*e0c4386eSCy Schubert        if ( !-f "$pkitsdir/$filename" ) {
810*e0c4386eSCy Schubert            print "\"$filename\" not found\n";
811*e0c4386eSCy Schubert        }
812*e0c4386eSCy Schubert        else {
813*e0c4386eSCy Schubert            my $ret;
814*e0c4386eSCy Schubert            my $cmdout    = "";
815*e0c4386eSCy Schubert            my $errmsg    = "";
816*e0c4386eSCy Schubert            my $epol      = "";
817*e0c4386eSCy Schubert            my $aset      = "";
818*e0c4386eSCy Schubert            my $uset      = "";
819*e0c4386eSCy Schubert            my $pol       = -1;
820*e0c4386eSCy Schubert            my $test_fail = 0;
821*e0c4386eSCy Schubert            my $cmd       = $ossl_cmd;
822*e0c4386eSCy Schubert            $cmd .= "-in $pkitsdir/$filename $exargs -policy_print";
823*e0c4386eSCy Schubert            @oparr = `$cmd`;
824*e0c4386eSCy Schubert            $ret   = $? >> 8;
825*e0c4386eSCy Schubert
826*e0c4386eSCy Schubert            if ( $? & 0xff ) {
827*e0c4386eSCy Schubert                $errmsg .= "Abnormal OpenSSL termination\n";
828*e0c4386eSCy Schubert                $test_fail = 1;
829*e0c4386eSCy Schubert            }
830*e0c4386eSCy Schubert            foreach (@oparr) {
831*e0c4386eSCy Schubert                my $test_failed = 0;
832*e0c4386eSCy Schubert                $cmdout .= $_;
833*e0c4386eSCy Schubert                if (/^Require explicit Policy: (.*)$/) {
834*e0c4386eSCy Schubert                    $epol = $1;
835*e0c4386eSCy Schubert                }
836*e0c4386eSCy Schubert                if (/^Authority Policies/) {
837*e0c4386eSCy Schubert                    if (/empty/) {
838*e0c4386eSCy Schubert                        $aset = "<empty>";
839*e0c4386eSCy Schubert                    }
840*e0c4386eSCy Schubert                    else {
841*e0c4386eSCy Schubert                        $pol = 1;
842*e0c4386eSCy Schubert                    }
843*e0c4386eSCy Schubert                }
844*e0c4386eSCy Schubert                $test_fail = 1 if (/leak/i);
845*e0c4386eSCy Schubert                if (/^User Policies/) {
846*e0c4386eSCy Schubert                    if (/empty/) {
847*e0c4386eSCy Schubert                        $uset = "<empty>";
848*e0c4386eSCy Schubert                    }
849*e0c4386eSCy Schubert                    else {
850*e0c4386eSCy Schubert                        $pol = 2;
851*e0c4386eSCy Schubert                    }
852*e0c4386eSCy Schubert                }
853*e0c4386eSCy Schubert                if (/\s+Policy: (.*)$/) {
854*e0c4386eSCy Schubert                    if ( $pol == 1 ) {
855*e0c4386eSCy Schubert                        $aset .= ":" if $aset ne "";
856*e0c4386eSCy Schubert                        $aset .= $1;
857*e0c4386eSCy Schubert                    }
858*e0c4386eSCy Schubert                    elsif ( $pol == 2 ) {
859*e0c4386eSCy Schubert                        $uset .= ":" if $uset ne "";
860*e0c4386eSCy Schubert                        $uset .= $1;
861*e0c4386eSCy Schubert                    }
862*e0c4386eSCy Schubert                }
863*e0c4386eSCy Schubert            }
864*e0c4386eSCy Schubert
865*e0c4386eSCy Schubert            if ( $epol ne $exp_epol ) {
866*e0c4386eSCy Schubert                $errmsg .= "Explicit policy:$epol, ";
867*e0c4386eSCy Schubert                $errmsg .= "expected $exp_epol\n";
868*e0c4386eSCy Schubert                $test_fail = 1;
869*e0c4386eSCy Schubert            }
870*e0c4386eSCy Schubert            if ( $aset ne $exp_aset ) {
871*e0c4386eSCy Schubert                $errmsg .= "Authority policy set :$aset, ";
872*e0c4386eSCy Schubert                $errmsg .= "expected $exp_aset\n";
873*e0c4386eSCy Schubert                $test_fail = 1;
874*e0c4386eSCy Schubert            }
875*e0c4386eSCy Schubert            if ( $uset ne $exp_uset ) {
876*e0c4386eSCy Schubert                $errmsg .= "User policy set :$uset, ";
877*e0c4386eSCy Schubert                $errmsg .= "expected $exp_uset\n";
878*e0c4386eSCy Schubert                $test_fail = 1;
879*e0c4386eSCy Schubert            }
880*e0c4386eSCy Schubert
881*e0c4386eSCy Schubert            if ( $exp_ret != $ret ) {
882*e0c4386eSCy Schubert                print "Return code:$ret, expected $exp_ret\n";
883*e0c4386eSCy Schubert                $test_fail = 1;
884*e0c4386eSCy Schubert            }
885*e0c4386eSCy Schubert
886*e0c4386eSCy Schubert            if ($test_fail) {
887*e0c4386eSCy Schubert                print "$tnum $title : Failed!\n";
888*e0c4386eSCy Schubert                print "Filename: $pkitsdir/$filename\n";
889*e0c4386eSCy Schubert                print "Command output:\n$cmdout\n";
890*e0c4386eSCy Schubert                $numfail++;
891*e0c4386eSCy Schubert            }
892*e0c4386eSCy Schubert            $numtest++;
893*e0c4386eSCy Schubert        }
894*e0c4386eSCy Schubert    }
895*e0c4386eSCy Schubert}
896*e0c4386eSCy Schubert
897*e0c4386eSCy Schubertif ($numfail) {
898*e0c4386eSCy Schubert    print "$numfail tests failed out of $numtest\n";
899*e0c4386eSCy Schubert}
900*e0c4386eSCy Schubertelse {
901*e0c4386eSCy Schubert    print "All Tests Successful.\n";
902*e0c4386eSCy Schubert}
903*e0c4386eSCy Schubert
904*e0c4386eSCy Schubertunlink "pkitsta.pem";
905*e0c4386eSCy Schubert
906