]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/pkits-test.pl
2 # Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # Perl utility to run PKITS tests for RFC3280 compliance.
13 if ( -f
"../apps/openssl" ) {
14 $ossl_path = "../util/shlib_wrap.sh ../apps/openssl";
16 elsif ( -f
"..\\out32dll\\openssl.exe" ) {
17 $ossl_path = "..\\out32dll\\openssl.exe";
19 elsif ( -f
"..\\out32\\openssl.exe" ) {
20 $ossl_path = "..\\out32\\openssl.exe";
23 die "Can't find OpenSSL executable";
26 my $pkitsdir = "pkits/smime";
27 my $pkitsta = "pkits/certs/TrustAnchorRootCertificate.crt";
29 die "Can't find PKITS test data" if !-d
$pkitsdir;
31 my $nist1 = "2.16.840.1.101.3.2.1.48.1";
32 my $nist2 = "2.16.840.1.101.3.2.1.48.2";
33 my $nist3 = "2.16.840.1.101.3.2.1.48.3";
34 my $nist4 = "2.16.840.1.101.3.2.1.48.4";
35 my $nist5 = "2.16.840.1.101.3.2.1.48.5";
36 my $nist6 = "2.16.840.1.101.3.2.1.48.6";
38 my $apolicy = "X509v3 Any Policy";
40 # This table contains the chapter headings of the accompanying PKITS
41 # document. They provide useful informational output and their names
42 # can be converted into the filename to test.
45 [ "4.1", "Signature Verification" ],
46 [ "4.1.1", "Valid Signatures Test1", 0 ],
47 [ "4.1.2", "Invalid CA Signature Test2", 7 ],
48 [ "4.1.3", "Invalid EE Signature Test3", 7 ],
49 [ "4.1.4", "Valid DSA Signatures Test4", 0 ],
50 [ "4.1.5", "Valid DSA Parameter Inheritance Test5", 0 ],
51 [ "4.1.6", "Invalid DSA Signature Test6", 7 ],
52 [ "4.2", "Validity Periods" ],
53 [ "4.2.1", "Invalid CA notBefore Date Test1", 9 ],
54 [ "4.2.2", "Invalid EE notBefore Date Test2", 9 ],
55 [ "4.2.3", "Valid pre2000 UTC notBefore Date Test3", 0 ],
56 [ "4.2.4", "Valid GeneralizedTime notBefore Date Test4", 0 ],
57 [ "4.2.5", "Invalid CA notAfter Date Test5", 10 ],
58 [ "4.2.6", "Invalid EE notAfter Date Test6", 10 ],
59 [ "4.2.7", "Invalid pre2000 UTC EE notAfter Date Test7", 10 ],
60 [ "4.2.8", "Valid GeneralizedTime notAfter Date Test8", 0 ],
61 [ "4.3", "Verifying Name Chaining" ],
62 [ "4.3.1", "Invalid Name Chaining EE Test1", 20 ],
63 [ "4.3.2", "Invalid Name Chaining Order Test2", 20 ],
64 [ "4.3.3", "Valid Name Chaining Whitespace Test3", 0 ],
65 [ "4.3.4", "Valid Name Chaining Whitespace Test4", 0 ],
66 [ "4.3.5", "Valid Name Chaining Capitalization Test5", 0 ],
67 [ "4.3.6", "Valid Name Chaining UIDs Test6", 0 ],
68 [ "4.3.7", "Valid RFC3280 Mandatory Attribute Types Test7", 0 ],
69 [ "4.3.8", "Valid RFC3280 Optional Attribute Types Test8", 0 ],
70 [ "4.3.9", "Valid UTF8String Encoded Names Test9", 0 ],
71 [ "4.3.10", "Valid Rollover from PrintableString to UTF8String Test10", 0 ],
72 [ "4.3.11", "Valid UTF8String Case Insensitive Match Test11", 0 ],
73 [ "4.4", "Basic Certificate Revocation Tests" ],
74 [ "4.4.1", "Missing CRL Test1", 3 ],
75 [ "4.4.2", "Invalid Revoked CA Test2", 23 ],
76 [ "4.4.3", "Invalid Revoked EE Test3", 23 ],
77 [ "4.4.4", "Invalid Bad CRL Signature Test4", 8 ],
78 [ "4.4.5", "Invalid Bad CRL Issuer Name Test5", 3 ],
79 [ "4.4.6", "Invalid Wrong CRL Test6", 3 ],
80 [ "4.4.7", "Valid Two CRLs Test7", 0 ],
82 # The test document suggests these should return certificate revoked...
83 # Subsequent discussion has concluded they should not due to unhandle
84 # critical CRL extensions.
85 [ "4.4.8", "Invalid Unknown CRL Entry Extension Test8", 36 ],
86 [ "4.4.9", "Invalid Unknown CRL Extension Test9", 36 ],
88 [ "4.4.10", "Invalid Unknown CRL Extension Test10", 36 ],
89 [ "4.4.11", "Invalid Old CRL nextUpdate Test11", 12 ],
90 [ "4.4.12", "Invalid pre2000 CRL nextUpdate Test12", 12 ],
91 [ "4.4.13", "Valid GeneralizedTime CRL nextUpdate Test13", 0 ],
92 [ "4.4.14", "Valid Negative Serial Number Test14", 0 ],
93 [ "4.4.15", "Invalid Negative Serial Number Test15", 23 ],
94 [ "4.4.16", "Valid Long Serial Number Test16", 0 ],
95 [ "4.4.17", "Valid Long Serial Number Test17", 0 ],
96 [ "4.4.18", "Invalid Long Serial Number Test18", 23 ],
97 [ "4.4.19", "Valid Separate Certificate and CRL Keys Test19", 0 ],
98 [ "4.4.20", "Invalid Separate Certificate and CRL Keys Test20", 23 ],
100 # CRL path is revoked so get a CRL path validation error
101 [ "4.4.21", "Invalid Separate Certificate and CRL Keys Test21", 54 ],
102 [ "4.5", "Verifying Paths with Self-Issued Certificates" ],
103 [ "4.5.1", "Valid Basic Self-Issued Old With New Test1", 0 ],
104 [ "4.5.2", "Invalid Basic Self-Issued Old With New Test2", 23 ],
105 [ "4.5.3", "Valid Basic Self-Issued New With Old Test3", 0 ],
106 [ "4.5.4", "Valid Basic Self-Issued New With Old Test4", 0 ],
107 [ "4.5.5", "Invalid Basic Self-Issued New With Old Test5", 23 ],
108 [ "4.5.6", "Valid Basic Self-Issued CRL Signing Key Test6", 0 ],
109 [ "4.5.7", "Invalid Basic Self-Issued CRL Signing Key Test7", 23 ],
110 [ "4.5.8", "Invalid Basic Self-Issued CRL Signing Key Test8", 20 ],
111 [ "4.6", "Verifying Basic Constraints" ],
112 [ "4.6.1", "Invalid Missing basicConstraints Test1", 24 ],
113 [ "4.6.2", "Invalid cA False Test2", 24 ],
114 [ "4.6.3", "Invalid cA False Test3", 24 ],
115 [ "4.6.4", "Valid basicConstraints Not Critical Test4", 0 ],
116 [ "4.6.5", "Invalid pathLenConstraint Test5", 25 ],
117 [ "4.6.6", "Invalid pathLenConstraint Test6", 25 ],
118 [ "4.6.7", "Valid pathLenConstraint Test7", 0 ],
119 [ "4.6.8", "Valid pathLenConstraint Test8", 0 ],
120 [ "4.6.9", "Invalid pathLenConstraint Test9", 25 ],
121 [ "4.6.10", "Invalid pathLenConstraint Test10", 25 ],
122 [ "4.6.11", "Invalid pathLenConstraint Test11", 25 ],
123 [ "4.6.12", "Invalid pathLenConstraint Test12", 25 ],
124 [ "4.6.13", "Valid pathLenConstraint Test13", 0 ],
125 [ "4.6.14", "Valid pathLenConstraint Test14", 0 ],
126 [ "4.6.15", "Valid Self-Issued pathLenConstraint Test15", 0 ],
127 [ "4.6.16", "Invalid Self-Issued pathLenConstraint Test16", 25 ],
128 [ "4.6.17", "Valid Self-Issued pathLenConstraint Test17", 0 ],
129 [ "4.7", "Key Usage" ],
130 [ "4.7.1", "Invalid keyUsage Critical keyCertSign False Test1", 20 ],
131 [ "4.7.2", "Invalid keyUsage Not Critical keyCertSign False Test2", 20 ],
132 [ "4.7.3", "Valid keyUsage Not Critical Test3", 0 ],
133 [ "4.7.4", "Invalid keyUsage Critical cRLSign False Test4", 35 ],
134 [ "4.7.5", "Invalid keyUsage Not Critical cRLSign False Test5", 35 ],
136 # Certificate policy tests need special handling. They can have several
137 # sub tests and we need to check the outputs are correct.
139 [ "4.8", "Certificate Policies" ],
142 "All Certificates Same Policy Test1",
143 "-policy anyPolicy -explicit_policy",
144 "True", $nist1, $nist1, 0
148 "All Certificates Same Policy Test1",
149 "-policy $nist1 -explicit_policy",
150 "True", $nist1, $nist1, 0
154 "All Certificates Same Policy Test1",
155 "-policy $nist2 -explicit_policy",
156 "True", $nist1, "<empty>", 43
160 "All Certificates Same Policy Test1",
161 "-policy $nist1 -policy $nist2 -explicit_policy",
162 "True", $nist1, $nist1, 0
166 "All Certificates No Policies Test2",
168 "False", "<empty>", "<empty>", 0
172 "All Certificates No Policies Test2",
173 "-policy anyPolicy -explicit_policy",
174 "True", "<empty>", "<empty>", 43
178 "Different Policies Test3",
180 "False", "<empty>", "<empty>", 0
184 "Different Policies Test3",
185 "-policy anyPolicy -explicit_policy",
186 "True", "<empty>", "<empty>", 43
190 "Different Policies Test3",
191 "-policy $nist1 -policy $nist2 -explicit_policy",
192 "True", "<empty>", "<empty>", 43
197 "Different Policies Test4",
199 "True", "<empty>", "<empty>", 43
203 "Different Policies Test5",
205 "True", "<empty>", "<empty>", 43
209 "Overlapping Policies Test6",
211 "True", $nist1, $nist1, 0
215 "Overlapping Policies Test6",
217 "True", $nist1, $nist1, 0
221 "Overlapping Policies Test6",
223 "True", $nist1, "<empty>", 43
227 "Different Policies Test7",
229 "True", "<empty>", "<empty>", 43
233 "Different Policies Test8",
235 "True", "<empty>", "<empty>", 43
239 "Different Policies Test9",
241 "True", "<empty>", "<empty>", 43
245 "All Certificates Same Policies Test10",
247 "True", "$nist1:$nist2", "$nist1", 0
251 "All Certificates Same Policies Test10",
253 "True", "$nist1:$nist2", "$nist2", 0
257 "All Certificates Same Policies Test10",
259 "True", "$nist1:$nist2", "$nist1:$nist2", 0
263 "All Certificates AnyPolicy Test11",
265 "True", "$apolicy", "$apolicy", 0
269 "All Certificates AnyPolicy Test11",
271 "True", "$apolicy", "$nist1", 0
275 "Different Policies Test12",
277 "True", "<empty>", "<empty>", 43
281 "All Certificates Same Policies Test13",
283 "True", "$nist1:$nist2:$nist3", "$nist1", 0
287 "All Certificates Same Policies Test13",
289 "True", "$nist1:$nist2:$nist3", "$nist2", 0
293 "All Certificates Same Policies Test13",
295 "True", "$nist1:$nist2:$nist3", "$nist3", 0
298 "4.8.14.1", "AnyPolicy Test14",
299 "-policy $nist1", "True",
304 "4.8.14.2", "AnyPolicy Test14",
305 "-policy $nist2", "True",
311 "User Notice Qualifier Test15",
313 "False", "$nist1", "$nist1", 0
317 "User Notice Qualifier Test16",
319 "False", "$nist1", "$nist1", 0
323 "User Notice Qualifier Test17",
325 "False", "$nist1", "$nist1", 0
329 "User Notice Qualifier Test18",
331 "True", "$nist1:$nist2", "$nist1", 0
335 "User Notice Qualifier Test18",
337 "True", "$nist1:$nist2", "$nist2", 0
341 "User Notice Qualifier Test19",
343 "False", "$nist1", "$nist1", 0
347 "CPS Pointer Qualifier Test20",
348 "-policy anyPolicy -explicit_policy",
349 "True", "$nist1", "$nist1", 0
351 [ "4.9", "Require Explicit Policy" ],
354 "Valid RequireExplicitPolicy Test1",
356 "False", "<empty>", "<empty>", 0
360 "Valid RequireExplicitPolicy Test2",
362 "False", "<empty>", "<empty>", 0
366 "Invalid RequireExplicitPolicy Test3",
368 "True", "<empty>", "<empty>", 43
372 "Valid RequireExplicitPolicy Test4",
374 "True", "$nist1", "$nist1", 0
378 "Invalid RequireExplicitPolicy Test5",
380 "True", "<empty>", "<empty>", 43
384 "Valid Self-Issued requireExplicitPolicy Test6",
386 "False", "<empty>", "<empty>", 0
390 "Invalid Self-Issued requireExplicitPolicy Test7",
392 "True", "<empty>", "<empty>", 43
396 "Invalid Self-Issued requireExplicitPolicy Test8",
398 "True", "<empty>", "<empty>", 43
400 [ "4.10", "Policy Mappings" ],
403 "Valid Policy Mapping Test1",
405 "True", "$nist1", "$nist1", 0
409 "Valid Policy Mapping Test1",
411 "True", "$nist1", "<empty>", 43
415 "Valid Policy Mapping Test1",
416 "-policy anyPolicy -inhibit_map",
417 "True", "<empty>", "<empty>", 43
421 "Invalid Policy Mapping Test2",
423 "True", "<empty>", "<empty>", 43
427 "Invalid Policy Mapping Test2",
428 "-policy anyPolicy -inhibit_map",
429 "True", "<empty>", "<empty>", 43
433 "Valid Policy Mapping Test3",
435 "True", "$nist2", "<empty>", 43
439 "Valid Policy Mapping Test3",
441 "True", "$nist2", "$nist2", 0
445 "Invalid Policy Mapping Test4",
447 "True", "<empty>", "<empty>", 43
451 "Valid Policy Mapping Test5",
453 "True", "$nist1", "$nist1", 0
457 "Valid Policy Mapping Test5",
459 "True", "$nist1", "<empty>", 43
463 "Valid Policy Mapping Test6",
465 "True", "$nist1", "$nist1", 0
469 "Valid Policy Mapping Test6",
471 "True", "$nist1", "<empty>", 43
473 [ "4.10.7", "Invalid Mapping From anyPolicy Test7", 42 ],
474 [ "4.10.8", "Invalid Mapping To anyPolicy Test8", 42 ],
477 "Valid Policy Mapping Test9",
479 "True", "$nist1", "$nist1", 0
483 "Invalid Policy Mapping Test10",
485 "True", "<empty>", "<empty>", 43
489 "Valid Policy Mapping Test11",
491 "True", "$nist1", "$nist1", 0
494 # TODO: check notice display
497 "Valid Policy Mapping Test12",
499 "True", "$nist1:$nist2", "$nist1", 0
502 # TODO: check notice display
505 "Valid Policy Mapping Test12",
507 "True", "$nist1:$nist2", "$nist2", 0
511 "Valid Policy Mapping Test13",
513 "True", "$nist1", "$nist1", 0
516 # TODO: check notice display
519 "Valid Policy Mapping Test14",
521 "True", "$nist1", "$nist1", 0
523 [ "4.11", "Inhibit Policy Mapping" ],
526 "Invalid inhibitPolicyMapping Test1",
528 "True", "<empty>", "<empty>", 43
532 "Valid inhibitPolicyMapping Test2",
534 "True", "$nist1", "$nist1", 0
538 "Invalid inhibitPolicyMapping Test3",
540 "True", "<empty>", "<empty>", 43
544 "Valid inhibitPolicyMapping Test4",
546 "True", "$nist2", "$nist2", 0
550 "Invalid inhibitPolicyMapping Test5",
552 "True", "<empty>", "<empty>", 43
556 "Invalid inhibitPolicyMapping Test6",
558 "True", "<empty>", "<empty>", 43
562 "Valid Self-Issued inhibitPolicyMapping Test7",
564 "True", "$nist1", "$nist1", 0
568 "Invalid Self-Issued inhibitPolicyMapping Test8",
570 "True", "<empty>", "<empty>", 43
574 "Invalid Self-Issued inhibitPolicyMapping Test9",
576 "True", "<empty>", "<empty>", 43
580 "Invalid Self-Issued inhibitPolicyMapping Test10",
582 "True", "<empty>", "<empty>", 43
586 "Invalid Self-Issued inhibitPolicyMapping Test11",
588 "True", "<empty>", "<empty>", 43
590 [ "4.12", "Inhibit Any Policy" ],
593 "Invalid inhibitAnyPolicy Test1",
595 "True", "<empty>", "<empty>", 43
599 "Valid inhibitAnyPolicy Test2",
601 "True", "$nist1", "$nist1", 0
605 "inhibitAnyPolicy Test3",
607 "True", "$nist1", "$nist1", 0
611 "inhibitAnyPolicy Test3",
612 "-policy anyPolicy -inhibit_any",
613 "True", "<empty>", "<empty>", 43
617 "Invalid inhibitAnyPolicy Test4",
619 "True", "<empty>", "<empty>", 43
623 "Invalid inhibitAnyPolicy Test5",
625 "True", "<empty>", "<empty>", 43
629 "Invalid inhibitAnyPolicy Test6",
631 "True", "<empty>", "<empty>", 43
633 [ "4.12.7", "Valid Self-Issued inhibitAnyPolicy Test7", 0 ],
634 [ "4.12.8", "Invalid Self-Issued inhibitAnyPolicy Test8", 43 ],
635 [ "4.12.9", "Valid Self-Issued inhibitAnyPolicy Test9", 0 ],
636 [ "4.12.10", "Invalid Self-Issued inhibitAnyPolicy Test10", 43 ],
637 [ "4.13", "Name Constraints" ],
638 [ "4.13.1", "Valid DN nameConstraints Test1", 0 ],
639 [ "4.13.2", "Invalid DN nameConstraints Test2", 47 ],
640 [ "4.13.3", "Invalid DN nameConstraints Test3", 47 ],
641 [ "4.13.4", "Valid DN nameConstraints Test4", 0 ],
642 [ "4.13.5", "Valid DN nameConstraints Test5", 0 ],
643 [ "4.13.6", "Valid DN nameConstraints Test6", 0 ],
644 [ "4.13.7", "Invalid DN nameConstraints Test7", 48 ],
645 [ "4.13.8", "Invalid DN nameConstraints Test8", 48 ],
646 [ "4.13.9", "Invalid DN nameConstraints Test9", 48 ],
647 [ "4.13.10", "Invalid DN nameConstraints Test10", 48 ],
648 [ "4.13.11", "Valid DN nameConstraints Test11", 0 ],
649 [ "4.13.12", "Invalid DN nameConstraints Test12", 47 ],
650 [ "4.13.13", "Invalid DN nameConstraints Test13", 47 ],
651 [ "4.13.14", "Valid DN nameConstraints Test14", 0 ],
652 [ "4.13.15", "Invalid DN nameConstraints Test15", 48 ],
653 [ "4.13.16", "Invalid DN nameConstraints Test16", 48 ],
654 [ "4.13.17", "Invalid DN nameConstraints Test17", 48 ],
655 [ "4.13.18", "Valid DN nameConstraints Test18", 0 ],
656 [ "4.13.19", "Valid Self-Issued DN nameConstraints Test19", 0 ],
657 [ "4.13.20", "Invalid Self-Issued DN nameConstraints Test20", 47 ],
658 [ "4.13.21", "Valid RFC822 nameConstraints Test21", 0 ],
659 [ "4.13.22", "Invalid RFC822 nameConstraints Test22", 47 ],
660 [ "4.13.23", "Valid RFC822 nameConstraints Test23", 0 ],
661 [ "4.13.24", "Invalid RFC822 nameConstraints Test24", 47 ],
662 [ "4.13.25", "Valid RFC822 nameConstraints Test25", 0 ],
663 [ "4.13.26", "Invalid RFC822 nameConstraints Test26", 48 ],
664 [ "4.13.27", "Valid DN and RFC822 nameConstraints Test27", 0 ],
665 [ "4.13.28", "Invalid DN and RFC822 nameConstraints Test28", 47 ],
666 [ "4.13.29", "Invalid DN and RFC822 nameConstraints Test29", 47 ],
667 [ "4.13.30", "Valid DNS nameConstraints Test30", 0 ],
668 [ "4.13.31", "Invalid DNS nameConstraints Test31", 47 ],
669 [ "4.13.32", "Valid DNS nameConstraints Test32", 0 ],
670 [ "4.13.33", "Invalid DNS nameConstraints Test33", 48 ],
671 [ "4.13.34", "Valid URI nameConstraints Test34", 0 ],
672 [ "4.13.35", "Invalid URI nameConstraints Test35", 47 ],
673 [ "4.13.36", "Valid URI nameConstraints Test36", 0 ],
674 [ "4.13.37", "Invalid URI nameConstraints Test37", 48 ],
675 [ "4.13.38", "Invalid DNS nameConstraints Test38", 47 ],
676 [ "4.14", "Distribution Points" ],
677 [ "4.14.1", "Valid distributionPoint Test1", 0 ],
678 [ "4.14.2", "Invalid distributionPoint Test2", 23 ],
679 [ "4.14.3", "Invalid distributionPoint Test3", 44 ],
680 [ "4.14.4", "Valid distributionPoint Test4", 0 ],
681 [ "4.14.5", "Valid distributionPoint Test5", 0 ],
682 [ "4.14.6", "Invalid distributionPoint Test6", 23 ],
683 [ "4.14.7", "Valid distributionPoint Test7", 0 ],
684 [ "4.14.8", "Invalid distributionPoint Test8", 44 ],
685 [ "4.14.9", "Invalid distributionPoint Test9", 44 ],
686 [ "4.14.10", "Valid No issuingDistributionPoint Test10", 0 ],
687 [ "4.14.11", "Invalid onlyContainsUserCerts CRL Test11", 44 ],
688 [ "4.14.12", "Invalid onlyContainsCACerts CRL Test12", 44 ],
689 [ "4.14.13", "Valid onlyContainsCACerts CRL Test13", 0 ],
690 [ "4.14.14", "Invalid onlyContainsAttributeCerts Test14", 44 ],
691 [ "4.14.15", "Invalid onlySomeReasons Test15", 23 ],
692 [ "4.14.16", "Invalid onlySomeReasons Test16", 23 ],
693 [ "4.14.17", "Invalid onlySomeReasons Test17", 3 ],
694 [ "4.14.18", "Valid onlySomeReasons Test18", 0 ],
695 [ "4.14.19", "Valid onlySomeReasons Test19", 0 ],
696 [ "4.14.20", "Invalid onlySomeReasons Test20", 23 ],
697 [ "4.14.21", "Invalid onlySomeReasons Test21", 23 ],
698 [ "4.14.22", "Valid IDP with indirectCRL Test22", 0 ],
699 [ "4.14.23", "Invalid IDP with indirectCRL Test23", 23 ],
700 [ "4.14.24", "Valid IDP with indirectCRL Test24", 0 ],
701 [ "4.14.25", "Valid IDP with indirectCRL Test25", 0 ],
702 [ "4.14.26", "Invalid IDP with indirectCRL Test26", 44 ],
703 [ "4.14.27", "Invalid cRLIssuer Test27", 3 ],
704 [ "4.14.28", "Valid cRLIssuer Test28", 0 ],
705 [ "4.14.29", "Valid cRLIssuer Test29", 0 ],
707 # Although this test is valid it has a circular dependency. As a result
708 # an attempt is made to recursively checks a CRL path and rejected due to
709 # a CRL path validation error. PKITS notes suggest this test does not
710 # need to be run due to this issue.
711 [ "4.14.30", "Valid cRLIssuer Test30", 54 ],
712 [ "4.14.31", "Invalid cRLIssuer Test31", 23 ],
713 [ "4.14.32", "Invalid cRLIssuer Test32", 23 ],
714 [ "4.14.33", "Valid cRLIssuer Test33", 0 ],
715 [ "4.14.34", "Invalid cRLIssuer Test34", 23 ],
716 [ "4.14.35", "Invalid cRLIssuer Test35", 44 ],
717 [ "4.15", "Delta-CRLs" ],
718 [ "4.15.1", "Invalid deltaCRLIndicator No Base Test1", 3 ],
719 [ "4.15.2", "Valid delta-CRL Test2", 0 ],
720 [ "4.15.3", "Invalid delta-CRL Test3", 23 ],
721 [ "4.15.4", "Invalid delta-CRL Test4", 23 ],
722 [ "4.15.5", "Valid delta-CRL Test5", 0 ],
723 [ "4.15.6", "Invalid delta-CRL Test6", 23 ],
724 [ "4.15.7", "Valid delta-CRL Test7", 0 ],
725 [ "4.15.8", "Valid delta-CRL Test8", 0 ],
726 [ "4.15.9", "Invalid delta-CRL Test9", 23 ],
727 [ "4.15.10", "Invalid delta-CRL Test10", 12 ],
728 [ "4.16", "Private Certificate Extensions" ],
729 [ "4.16.1", "Valid Unknown Not Critical Certificate Extension Test1", 0 ],
730 [ "4.16.2", "Invalid Unknown Critical Certificate Extension Test2", 34 ],
739 my $ossl = "ossl/apps/openssl";
741 my $ossl_cmd = "$ossl_path cms -verify -verify_retcode ";
742 $ossl_cmd .= "-CAfile pkitsta.pem -crl_check_all -x509_strict ";
744 # Check for expiry of trust anchor
745 system "$ossl_path x509 -inform DER -in $pkitsta -checkend 0";
748 print STDERR
"WARNING: using older expired data\n";
749 $ossl_cmd .= "-attime 1291940972 ";
752 $ossl_cmd .= "-policy_check -extended_crl -use_deltas -out /dev/null 2>&1 ";
754 system "$ossl_path x509 -inform DER -in $pkitsta -out pkitsta.pem";
756 die "Can't create trust anchor file" if $?
;
758 print "Running PKITS tests:\n" if $verbose;
760 foreach (@testlists) {
762 if ( $argnum == 2 ) {
763 my ( $tnum, $title ) = @
$_;
764 print "$tnum $title\n" if $verbose;
766 elsif ( $argnum == 3 ) {
767 my ( $tnum, $title, $exp_ret ) = @
$_;
768 my $filename = $title;
769 $exp_ret += 32 if $exp_ret;
770 $filename =~ tr/ -//d;
771 $filename = "Signed${filename}.eml";
772 if ( !-f
"$pkitsdir/$filename" ) {
773 print "\"$filename\" not found\n";
780 $cmd .= "-in $pkitsdir/$filename -policy anyPolicy";
784 $errmsg .= "Abnormal OpenSSL termination\n";
787 if ( $exp_ret != $ret ) {
788 $errmsg .= "Return code:$ret, ";
789 $errmsg .= "expected $exp_ret\n";
793 print "$tnum $title : Failed!\n";
794 print "Filename: $pkitsdir/$filename\n";
796 print "Command output:\n$cmdout\n";
802 elsif ( $argnum == 7 ) {
803 my ( $tnum, $title, $exargs, $exp_epol, $exp_aset, $exp_uset, $exp_ret )
805 my $filename = $title;
806 $exp_ret += 32 if $exp_ret;
807 $filename =~ tr/ -//d;
808 $filename = "Signed${filename}.eml";
809 if ( !-f
"$pkitsdir/$filename" ) {
810 print "\"$filename\" not found\n";
822 $cmd .= "-in $pkitsdir/$filename $exargs -policy_print";
827 $errmsg .= "Abnormal OpenSSL termination\n";
833 if (/^Require explicit Policy: (.*)$/) {
836 if (/^Authority Policies/) {
844 $test_fail = 1 if (/leak/i);
845 if (/^User Policies/) {
853 if (/\s+Policy: (.*)$/) {
855 $aset .= ":" if $aset ne "";
858 elsif ( $pol == 2 ) {
859 $uset .= ":" if $uset ne "";
865 if ( $epol ne $exp_epol ) {
866 $errmsg .= "Explicit policy:$epol, ";
867 $errmsg .= "expected $exp_epol\n";
870 if ( $aset ne $exp_aset ) {
871 $errmsg .= "Authority policy set :$aset, ";
872 $errmsg .= "expected $exp_aset\n";
875 if ( $uset ne $exp_uset ) {
876 $errmsg .= "User policy set :$uset, ";
877 $errmsg .= "expected $exp_uset\n";
881 if ( $exp_ret != $ret ) {
882 print "Return code:$ret, expected $exp_ret\n";
887 print "$tnum $title : Failed!\n";
888 print "Filename: $pkitsdir/$filename\n";
889 print "Command output:\n$cmdout\n";
898 print "$numfail tests failed out of $numtest\n";
901 print "All Tests Successful.\n";
904 unlink "pkitsta.pem";