summaryrefslogtreecommitdiff
path: root/security/nss/tests/pkits/pkits.sh
blob: e79fdd382302a4f07f81b3d8c62e1b6be4d55cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
#!/bin/bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

########################################################################
#
# mozilla/security/nss/tests/pkits/pkits.sh
#
# Script to test the NIST PKITS tests 
#
# needs to work on all Unix and Windows platforms
#
# tests implemented:
#    vfychain 
#
# special NOTES
# ---------------
# NIST PKITS data needs to be downloaded from
# http://csrc.nist.gov/pki/testing/x509paths.html
# Environment variable PKITS_DATA needs to be set to the directory
# where this data is downloaded, or test data needs to be copied under 
# the mozilla source tree in mozilla/PKITS_DATA
########################################################################

############################## pkits_init ##############################
# local shell function to initialize this script 
########################################################################
pkits_init()
{
  SCRIPTNAME=pkits.sh

  if [ -z "${CLEANUP}" ] ; then
      CLEANUP="${SCRIPTNAME}"
  fi

  if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
      cd ../common
      . ./init.sh
  fi

  if [ -z "${PKITS_DATA}" ]; then
      echo "${SCRIPTNAME}: PKITS data directory not defined, skipping."
      exit 0
  fi      

  if [ ! -d "${PKITS_DATA}" ]; then
      echo "${SCRIPTNAME}: PKITS data directory ${PKITS_DATA} doesn't exist, skipping."
      exit 0
  fi

  PKITSDIR=${HOSTDIR}/pkits

  COPYDIR=${PKITSDIR}/copydir

  mkdir -p ${PKITSDIR}
  mkdir -p ${COPYDIR}
  mkdir -p ${PKITSDIR}/html

  certs=${PKITS_DATA}/certs
  crls=${PKITS_DATA}/crls

  cd ${PKITSDIR}

  PKITSdb=${PKITSDIR}/PKITSdb
  PKITSbkp=${PKITSDIR}/PKITSbkp

  PKITS_LOG=${PKITSDIR}/pkits.log #getting its own logfile
  pkits_log "Start of logfile $PKITS_LOG"

  if [ ! -d "${PKITSdb}" ]; then
      mkdir -p ${PKITSdb}
  else
      pkits_log "$SCRIPTNAME: WARNING - ${PKITSdb} exists"
  fi

  if [ ! -d "${PKITSbkp}" ]; then
      mkdir -p ${PKITSbkp}
  else
      pkits_log "$SCRIPTNAME: WARNING - ${PKITSbkp} exists"
  fi

  echo "HOSTDIR" $HOSTDIR
  echo "PKITSDIR" $PKITSDIR
  echo "PKITSdb" $PKITSdb
  echo "PKITSbkp" $PKITSbkp
  echo "PKITS_DATA" $PKITS_DATA
  echo "certs" $certs
  echo "crls" $crls

  echo nss > ${PKITSdb}/pw
  ${BINDIR}/certutil -N -d ${PKITSdb} -f ${PKITSdb}/pw

  ${BINDIR}/certutil -A -n TrustAnchorRootCertificate -t "C,C,C" -i \
      $certs/TrustAnchorRootCertificate.crt -d $PKITSdb -f ${PKITSdb}/pw
  if [ -z "$NSS_NO_PKITS_CRLS" ]; then
    ${BINDIR}/crlutil -I -i $crls/TrustAnchorRootCRL.crl -d ${PKITSdb} -f ${PKITSdb}/pw
  else
    html  "<H3>NO CRLs are being used.</H3>"
    pkits_log "NO CRLs are being used."
  fi

  cp ${PKITSdb}/* ${PKITSbkp}

  KNOWN_BUG=
}

############################### pkits_log ##############################
# write to pkits.log file
########################################################################
pkits_log()
{
  echo "$SCRIPTNAME $*"
  echo $* >> ${PKITS_LOG}
}

restore_db()
{
  echo "Restore DB"
  rm ${PKITSdb}/*
  cp ${PKITSbkp}/* ${PKITSdb}
}

log_banner()
{
  echo ""
  echo "--------------------------------------------------------------------"
  echo "Test case ${VFY_ACTION}"
  echo ""
}

start_table()
{
  html "<TABLE BORDER=1><TR><TH COLSPAN=3>$*</TH></TR>"
  html "<TR><TH width=500>Test Case</TH><TH width=50>Result</TH></TR>" 
  echo ""
  echo "***************************************************************"
  echo "$*"
  echo "***************************************************************"
}

break_table()
{
  html "</TABLE><P>"
  start_table "$@"
}

################################ pkits #################################
# local shell function for positive testcases, calls vfychain, writes 
# action and options to stdout, sets variable RET and writes results to 
# the html file results
########################################################################
pkits()
{
  echo "vfychain -d $PKITSdb -u 4 $*"
  ${BINDIR}/vfychain -d $PKITSdb -u 4 $* > ${PKITSDIR}/cmdout.txt 2>&1
  RET=$?
  CNT=`grep -c ERROR ${PKITSDIR}/cmdout.txt`
  RET=`expr ${RET} + ${CNT}`
  cat ${PKITSDIR}/cmdout.txt

  if [ "$RET" -ne 0 ]; then
      html_failed "${VFY_ACTION} ($RET) "
      pkits_log "ERROR: ${VFY_ACTION} failed $RET"
  else
      html_passed "${VFY_ACTION}"
      pkits_log "SUCCESS: ${VFY_ACTION} returned as expected $RET"
  fi

  return $RET
}

################################ pkitsn #################################
# local shell function for negative testcases, calls vfychain, writes 
# action and options to stdout, sets variable RET and writes results to 
# the html file results
########################################################################
pkitsn()
{
  echo "vfychain -d $PKITSdb -u 4 $*"
  ${BINDIR}/vfychain -d $PKITSdb -u 4 $* > ${PKITSDIR}/cmdout.txt 2>&1
  RET=$?
  CNT=`grep -c ERROR ${PKITSDIR}/cmdout.txt`
  RET=`expr ${RET} + ${CNT}`
  cat ${PKITSDIR}/cmdout.txt

  if [ "$RET" -eq 0 ]; then
      html_failed "${VFY_ACTION} ($RET) "
      pkits_log "ERROR: ${VFY_ACTION} failed $RET"
  else
      html_passed "${VFY_ACTION} ($RET) "
      pkits_log "SUCCESS: ${VFY_ACTION} returned as expected $RET"
  fi
  return $RET
}

################################ crlImport #############################
# local shell function to import a CRL, calls crlutil -I -i, writes 
# action and options to stdout
########################################################################
crlImport()
{
  if [ -z "$NSS_NO_PKITS_CRLS" ]; then
    echo "crlutil -d $PKITSdb -I -f ${PKITSdb}/pw -i $crls/$*"
    ${BINDIR}/crlutil -d ${PKITSdb} -I -f ${PKITSdb}/pw -i $crls/$* > ${PKITSDIR}/cmdout.txt 2>&1
    RET=$?
    cat ${PKITSDIR}/cmdout.txt

    if [ "$RET" -ne 0 ]; then
        html_failed "${VFY_ACTION} ($RET) "
        pkits_log "ERROR: ${VFY_ACTION} failed $RET"
    fi
  fi
}

################################ crlImportn #############################
# local shell function to import an incorrect CRL, calls crlutil -I -i, 
# writes action and options to stdout
########################################################################
crlImportn()
{
  RET=0
  if [ -z "$NSS_NO_PKITS_CRLS" ]; then
    echo "crlutil -d $PKITSdb -I -f ${PKITSdb}/pw -i $crls/$*"
    ${BINDIR}/crlutil -d ${PKITSdb} -I -f ${PKITSdb}/pw -i $crls/$* > ${PKITSDIR}/cmdout.txt 2>&1
    RET=$?
    cat ${PKITSDIR}/cmdout.txt

    if [ "$RET" -eq 0 ]; then
        html_failed "${VFY_ACTION} ($RET) "
        pkits_log "ERROR: ${VFY_ACTION} failed $RET"
    else
        html_passed "${VFY_ACTION} ($RET) "
        pkits_log "SUCCESS: ${VFY_ACTION} returned as expected $RET"
    fi
  fi
  return $RET
}

################################ certImport #############################
# local shell function to import a Cert, calls certutil -A, writes 
# action and options to stdout
########################################################################
certImport()
{
  echo "certutil -d $PKITSdb -A -t \",,\" -n $* -i $certs/$*.crt"
  ${BINDIR}/certutil -d $PKITSdb -A -t ",," -n $* -i $certs/$*.crt > ${PKITSDIR}/cmdout.txt 2>&1
  RET=$?
  cat ${PKITSDIR}/cmdout.txt

  if [ "$RET" -ne 0 ]; then
      html_failed "${VFY_ACTION} ($RET) "
      pkits_log "ERROR: ${VFY_ACTION} failed $RET"
  fi
}

################################ certImportn #############################
# local shell function to import an incorrect Cert, calls certutil -A, 
# writes action and options to stdout
########################################################################
certImportn()
{
  RET=0
  if [ -z "$NSS_NO_PKITS_CRLS" ]; then
    echo "certutil -d $PKITSdb -A -t \",,\" -n $* -i $certs/$*.crt"
    ${BINDIR}/certutil -d $PKITSdb -A -t ",," -n $* -i $certs/$*.crt > ${PKITSDIR}/cmdout.txt 2>&1
    RET=$?
    cat ${PKITSDIR}/cmdout.txt

    if [ "$RET" -eq 0 ]; then
        html_failed "${VFY_ACTION} ($RET) "
        pkits_log "ERROR: ${VFY_ACTION} failed $RET"
    else
        html_passed "${VFY_ACTION} ($RET) "
        pkits_log "SUCCESS: ${VFY_ACTION} returned as expected $RET"
    fi
  fi
}

############################## pkits_tests_bySection ###################
# running the various PKITS tests
########################################################################
pkits_SignatureVerification()
{
  start_table "NIST PKITS Section 4.1: Signature Verification"

  VFY_ACTION="Valid Signatures Test1"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidCertificatePathTest1EE.crt $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid CA Signature Test2"; log_banner
  certImport BadSignedCACert
  crlImport BadSignedCACRL.crl
  pkitsn $certs/InvalidCASignatureTest2EE.crt \
    $certs/BadSignedCACert.crt
  restore_db

  VFY_ACTION="Invalid EE Signature Test3"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidEESignatureTest3EE.crt $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid DSA Signatures Test4"; log_banner
  certImport DSACACert
  crlImport DSACACRL.crl
  pkits $certs/ValidDSASignaturesTest4EE.crt $certs/DSACACert.crt
  restore_db

  # NSS doesn't support DSA parameter inheritance anymore (see bug 671097)
  # VFY_ACTION="Valid DSA Parameter Inheritance Test5"; log_banner
  # certImport DSACACert
  # crlImport DSACACRL.crl
  # certImport DSAParametersInheritedCACert
  # crlImport DSAParametersInheritedCACRL.crl
  # pkits $certs/ValidDSAParameterInheritanceTest5EE.crt \
  #     $certs/DSAParametersInheritedCACert.crt \
  #     $certs/DSACACert.crt
  # restore_db

  VFY_ACTION="Invalid DSA Signature Test6"; log_banner
  certImport DSACACert
  crlImport DSACACRL.crl
  pkitsn $certs/InvalidDSASignatureTest6EE.crt $certs/DSACACert.crt
  restore_db
}

pkits_ValidityPeriods()
{
  break_table "NIST PKITS Section 4.2: Validity Periods"

  VFY_ACTION="Invalid CA notBefore Date Test1"; log_banner
  certImport BadnotBeforeDateCACert
  crlImportn BadnotBeforeDateCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidCAnotBeforeDateTest1EE.crt \
          $certs/BadnotBeforeDateCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid EE notBefore Date Test2"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidEEnotBeforeDateTest2EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid pre2000 UTC notBefore Date Test3"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/Validpre2000UTCnotBeforeDateTest3EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid GeneralizedTime notBefore Date Test4"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidGeneralizedTimenotBeforeDateTest4EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid CA notAfter Date Test5"; log_banner
  certImport BadnotAfterDateCACert
  crlImportn BadnotAfterDateCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidCAnotAfterDateTest5EE.crt \
          $certs/BadnotAfterDateCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid EE notAfter Date Test6"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidEEnotAfterDateTest6EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid pre2000 UTC EE notAfter Date Test7"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/Invalidpre2000UTCEEnotAfterDateTest7EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="ValidGeneralizedTime notAfter Date Test8"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidGeneralizedTimenotAfterDateTest8EE.crt \
      $certs/GoodCACert.crt
  restore_db
}

pkits_NameChaining()
{
  break_table "NIST PKITS Section 4.3: Verifying NameChaining"

  VFY_ACTION="Invalid Name Chaining EE Test1"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidNameChainingTest1EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid Name Chaining Order Test2"; log_banner
  certImport NameOrderingCACert
  crlImport NameOrderCACRL.crl
  pkitsn $certs/InvalidNameChainingOrderTest2EE.crt \
      $certs/NameOrderingCACert.crt
  restore_db

### bug 216123 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Name Chaining Whitespace Test3"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidNameChainingWhitespaceTest3EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid Name Chaining Whitespace Test4"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidNameChainingWhitespaceTest4EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid Name Chaining Capitalization Test5"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidNameChainingCapitalizationTest5EE.crt \
      $certs/GoodCACert.crt
  restore_db
fi

  VFY_ACTION="Valid Name Chaining UIDs Test6"; log_banner
  certImport UIDCACert
  crlImport UIDCACRL.crl
  pkits $certs/ValidNameUIDsTest6EE.crt $certs/UIDCACert.crt
  restore_db

  VFY_ACTION="Valid RFC3280 Mandatory Attribute Types Test7"; log_banner
  certImport RFC3280MandatoryAttributeTypesCACert
  crlImport RFC3280MandatoryAttributeTypesCACRL.crl
  pkits $certs/ValidRFC3280MandatoryAttributeTypesTest7EE.crt \
      $certs/RFC3280MandatoryAttributeTypesCACert.crt
  restore_db

  VFY_ACTION="Valid RFC3280 Optional Attribute Types Test8"; log_banner
  certImport RFC3280OptionalAttributeTypesCACert
  crlImport RFC3280OptionalAttributeTypesCACRL.crl
  pkits $certs/ValidRFC3280OptionalAttributeTypesTest8EE.crt \
      $certs/RFC3280OptionalAttributeTypesCACert.crt
  restore_db

  VFY_ACTION="Valid UTF8String Encoded Names Test9"; log_banner
  certImport UTF8StringEncodedNamesCACert
  crlImport UTF8StringEncodedNamesCACRL.crl
  pkits $certs/ValidUTF8StringEncodedNamesTest9EE.crt \
      $certs/UTF8StringEncodedNamesCACert.crt
  restore_db

### bug 216123 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Rollover from PrintableString to UTF8String Test10"; log_banner
  certImport RolloverfromPrintableStringtoUTF8StringCACert
  crlImport RolloverfromPrintableStringtoUTF8StringCACRL.crl
  pkits $certs/ValidRolloverfromPrintableStringtoUTF8StringTest10EE.crt \
      $certs/RolloverfromPrintableStringtoUTF8StringCACert.crt
  restore_db

  VFY_ACTION="Valid UTF8String case Insensitive Match Test11"; log_banner
  certImport UTF8StringCaseInsensitiveMatchCACert
  crlImport UTF8StringCaseInsensitiveMatchCACRL.crl
  pkits $certs/ValidUTF8StringCaseInsensitiveMatchTest11EE.crt \
      $certs/UTF8StringCaseInsensitiveMatchCACert.crt
  restore_db
fi
}

pkits_BasicCertRevocation()
{
  break_table "NIST PKITS Section 4.4: Basic Certificate Revocation Tests"

### bug 414556 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Missing CRL Test1"; log_banner
  pkitsn $certs/InvalidMissingCRLTest1EE.crt \
      $certs/NoCRLCACert.crt
fi

  VFY_ACTION="Invalid Revoked CA Test2"; log_banner
  certImport RevokedsubCACert
  crlImport RevokedsubCACRL.crl
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidRevokedCATest2EE.crt \
     $certs/RevokedsubCACert.crt $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid Revoked EE Test3"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkitsn $certs/InvalidRevokedEETest3EE.crt \
     $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Invalid Bad CRL Signature Test4"; log_banner
  certImport BadCRLSignatureCACert
  crlImportn BadCRLSignatureCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidBadCRLSignatureTest4EE.crt \
          $certs/BadCRLSignatureCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid Bad CRL Issuer Name Test5"; log_banner
  certImport BadCRLIssuerNameCACert
  crlImportn BadCRLIssuerNameCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidBadCRLIssuerNameTest5EE.crt \
          $certs/BadCRLIssuerNameCACert.crt
  fi
  restore_db

### bug 414556 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Invalid Wrong CRL Test6"; log_banner
  certImport WrongCRLCACert
  crlImport WrongCRLCACRL.crl
  pkitsn $certs/InvalidWrongCRLTest6EE.crt \
      $certs/WrongCRLCACert.crt
  restore_db
fi

  VFY_ACTION="Valid Two CRLs Test7"; log_banner
  certImport TwoCRLsCACert
  crlImport TwoCRLsCAGoodCRL.crl
  crlImportn TwoCRLsCABadCRL.crl
  pkits $certs/ValidTwoCRLsTest7EE.crt \
     $certs/TwoCRLsCACert.crt
  restore_db

  VFY_ACTION="Invalid Unknown CRL Entry Extension Test8"; log_banner
  certImport UnknownCRLEntryExtensionCACert
  crlImportn UnknownCRLEntryExtensionCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidUnknownCRLEntryExtensionTest8EE.crt \
          $certs/UnknownCRLEntryExtensionCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid Unknown CRL Extension Test9"; log_banner
  certImport UnknownCRLExtensionCACert
  crlImportn UnknownCRLExtensionCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidUnknownCRLExtensionTest9EE.crt \
          $certs/UnknownCRLExtensionCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid Unknown CRL Extension Test10"; log_banner
  certImport UnknownCRLExtensionCACert
  crlImportn UnknownCRLExtensionCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidUnknownCRLExtensionTest10EE.crt \
          $certs/UnknownCRLExtensionCACert.crt
  fi
  restore_db

### bug 414563 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Invalid Old CRL nextUpdate Test11"; log_banner
  certImport OldCRLnextUpdateCACert
  crlImport OldCRLnextUpdateCACRL.crl
  pkitsn $certs/InvalidOldCRLnextUpdateTest11EE.crt \
     $certs/OldCRLnextUpdateCACert.crt
  restore_db

  VFY_ACTION="Invalid pre2000 CRL nextUpdate Test12"; log_banner
  certImport pre2000CRLnextUpdateCACert
  crlImport pre2000CRLnextUpdateCACRL.crl
  pkitsn $certs/Invalidpre2000CRLnextUpdateTest12EE.crt \
     $certs/pre2000CRLnextUpdateCACert.crt
  restore_db
fi

  VFY_ACTION="Valid GeneralizedTime CRL nextUpdate Test13"; log_banner
  certImport GeneralizedTimeCRLnextUpdateCACert
  crlImport GeneralizedTimeCRLnextUpdateCACRL.crl
  pkits $certs/ValidGeneralizedTimeCRLnextUpdateTest13EE.crt \
     $certs/GeneralizedTimeCRLnextUpdateCACert.crt
  restore_db

  VFY_ACTION="Valid Negative Serial Number Test14"; log_banner
  certImport NegativeSerialNumberCACert
  crlImport NegativeSerialNumberCACRL.crl
  pkits $certs/ValidNegativeSerialNumberTest14EE.crt \
     $certs/NegativeSerialNumberCACert.crt
  restore_db

  VFY_ACTION="Invalid Negative Serial Number Test15"; log_banner
  certImport NegativeSerialNumberCACert
  crlImport NegativeSerialNumberCACRL.crl
  pkitsn $certs/InvalidNegativeSerialNumberTest15EE.crt \
     $certs/NegativeSerialNumberCACert.crt
  restore_db

  VFY_ACTION="Valid Long Serial Number Test16"; log_banner
  certImport LongSerialNumberCACert
  crlImport LongSerialNumberCACRL.crl
  pkits $certs/ValidLongSerialNumberTest16EE.crt \
     $certs/LongSerialNumberCACert.crt
  restore_db

  VFY_ACTION="Valid Long Serial Number Test17"; log_banner
  certImport LongSerialNumberCACert
  crlImport LongSerialNumberCACRL.crl
  pkits $certs/ValidLongSerialNumberTest17EE.crt \
     $certs/LongSerialNumberCACert.crt
  restore_db

  VFY_ACTION="Invalid Long Serial Number Test18"; log_banner
  certImport LongSerialNumberCACert
  crlImport LongSerialNumberCACRL.crl
  pkitsn $certs/InvalidLongSerialNumberTest18EE.crt \
     $certs/LongSerialNumberCACert.crt
  restore_db

### bug 232737 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Separate Certificate and CRL Keys Test19"; log_banner
  certImport SeparateCertificateandCRLKeysCertificateSigningCACert
  certImport SeparateCertificateandCRLKeysCRLSigningCert
  crlImport SeparateCertificateandCRLKeysCRL.crl
  pkits $certs/ValidSeparateCertificateandCRLKeysTest19EE.crt \
     $certs/SeparateCertificateandCRLKeysCRLSigningCert.crt
  restore_db

  VFY_ACTION="Invalid Separate Certificate and CRL Keys Test20"; log_banner
  certImport SeparateCertificateandCRLKeysCertificateSigningCACert
  certImport SeparateCertificateandCRLKeysCRLSigningCert
  crlImport SeparateCertificateandCRLKeysCRL.crl
  pkits $certs/InvalidSeparateCertificateandCRLKeysTest20EE.crt \
     $certs/SeparateCertificateandCRLKeysCRLSigningCert.crt
  restore_db

  VFY_ACTION="Invalid Separate Certificate and CRL Keys Test21"; log_banner
  certImport SeparateCertificateandCRLKeysCA2CertificateSigningCACert
  certImport SeparateCertificateandCRLKeysCA2CRLSigningCert
  crlImport SeparateCertificateandCRLKeysCA2CRL.crl
  pkits $certs/InvalidSeparateCertificateandCRLKeysTest21EE.crt \
     $certs/SeparateCertificateandCRLKeysCA2CRLSigningCert.crt
  restore_db
fi
}

pkits_PathVerificWithSelfIssuedCerts()
{
  break_table "NIST PKITS Section 4.5: Self-Issued Certificates"

### bug 232737 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Basic Self-Issued Old With New Test1"; log_banner
  certImport BasicSelfIssuedNewKeyCACert
  crlImport BasicSelfIssuedNewKeyCACRL.crl
  pkits $certs/ValidBasicSelfIssuedOldWithNewTest1EE.crt \
      $certs/BasicSelfIssuedNewKeyOldWithNewCACert.crt \
      $certs/BasicSelfIssuedNewKeyCACert.crt
  restore_db

  VFY_ACTION="Invalid Basic Self-Issued Old With New Test2"; log_banner
  certImport BasicSelfIssuedNewKeyCACert
  crlImport BasicSelfIssuedNewKeyCACRL.crl
  pkitsn $certs/InvalidBasicSelfIssuedOldWithNewTest2EE.crt \
      $certs/BasicSelfIssuedNewKeyOldWithNewCACert.crt \
      $certs/BasicSelfIssuedNewKeyCACert.crt
  restore_db
fi

### bugs 321755 & 418769 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Basic Self-Issued New With Old Test3"; log_banner
  certImport BasicSelfIssuedOldKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkits $certs/ValidBasicSelfIssuedNewWithOldTest3EE.crt \
      $certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt \
      $certs/BasicSelfIssuedOldKeyCACert.crt
  restore_db

  VFY_ACTION="Valid Basic Self-Issued New With Old Test4"; log_banner
  certImport BasicSelfIssuedOldKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkits $certs/ValidBasicSelfIssuedNewWithOldTest4EE.crt \
      $certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt \
      $certs/BasicSelfIssuedOldKeyCACert.crt
  restore_db

  VFY_ACTION="Invalid Basic Self-Issued New With Old Test5"; log_banner
  certImport BasicSelfIssuedOldKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkitsn $certs/InvalidBasicSelfIssuedNewWithOldTest5EE.crt \
      $certs/BasicSelfIssuedOldKeyNewWithOldCACert.crt \
      $certs/BasicSelfIssuedOldKeyCACert.crt
  restore_db

  VFY_ACTION="Valid Basic Self-Issued CRL Signing Key Test6"; log_banner
  certImport BasicSelfIssuedCRLSigningKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkits $certs/ValidBasicSelfIssuedCRLSigningKeyTest6EE.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCACert.crt
  restore_db

  VFY_ACTION="Invalid Basic Self-Issued CRL Signing Key Test7"; log_banner
  certImport BasicSelfIssuedCRLSigningKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkitsn $certs/InvalidBasicSelfIssuedCRLSigningKeyTest7EE.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCACert.crt
  restore_db

  VFY_ACTION="Invalid Basic Self-Issued CRL Signing Key Test8"; log_banner
  certImport BasicSelfIssuedCRLSigningKeyCACert
  crlImport BasicSelfIssuedOldKeyCACRL.crl
  pkitsn $certs/InvalidBasicSelfIssuedCRLSigningKeyTest8EE.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCRLCert.crt \
      $certs/BasicSelfIssuedCRLSigningKeyCACert.crt
  restore_db
fi
}

pkits_BasicConstraints()
{
  break_table "NIST PKITS Section 4.6: Verifying Basic Constraints"

  VFY_ACTION="Invalid Missing basicConstraints Test1"; log_banner
  certImport MissingbasicConstraintsCACert
  crlImport MissingbasicConstraintsCACRL.crl
  pkitsn $certs/InvalidMissingbasicConstraintsTest1EE.crt \
      $certs/MissingbasicConstraintsCACert.crt
  restore_db

  VFY_ACTION="Invalid cA False Test2"; log_banner
  certImport basicConstraintsCriticalcAFalseCACert
  crlImport basicConstraintsCriticalcAFalseCACRL.crl
  pkitsn $certs/InvalidcAFalseTest2EE.crt \
      $certs/basicConstraintsCriticalcAFalseCACert.crt
  restore_db

  VFY_ACTION="Invalid cA False Test3"; log_banner
  certImport basicConstraintsNotCriticalcAFalseCACert
  crlImport basicConstraintsNotCriticalcAFalseCACRL.crl
  pkitsn $certs/InvalidcAFalseTest3EE.crt \
      $certs/basicConstraintsNotCriticalcAFalseCACert.crt
  restore_db

  VFY_ACTION="Valid basicConstraints Not Critical Test4"; log_banner
  certImport basicConstraintsNotCriticalCACert
  crlImport basicConstraintsNotCriticalCACRL.crl
  pkits $certs/ValidbasicConstraintsNotCriticalTest4EE.crt \
      $certs/basicConstraintsNotCriticalCACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint Test5"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  certImport pathLenConstraint0subCACert
  crlImport pathLenConstraint0subCACRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest5EE.crt \
      $certs/pathLenConstraint0subCACert.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint Test6"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  certImport pathLenConstraint0subCACert
  crlImport pathLenConstraint0subCACRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest6EE.crt \
      $certs/pathLenConstraint0subCACert.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db

  VFY_ACTION="Valid pathLenConstraint Test7"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  pkits $certs/ValidpathLenConstraintTest7EE.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db

  VFY_ACTION="Valid pathLenConstraint test8"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  pkits $certs/ValidpathLenConstraintTest8EE.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint Test9"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA0Cert
  crlImport pathLenConstraint6subCA0CRL.crl
  certImport pathLenConstraint6subsubCA00Cert
  crlImport pathLenConstraint6subsubCA00CRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest9EE.crt \
      $certs/pathLenConstraint6subsubCA00Cert.crt \
      $certs/pathLenConstraint6subCA0Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint Test10"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA0Cert
  crlImport pathLenConstraint6subCA0CRL.crl
  certImport pathLenConstraint6subsubCA00Cert
  crlImport pathLenConstraint6subsubCA00CRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest10EE.crt \
      $certs/pathLenConstraint6subsubCA00Cert.crt \
      $certs/pathLenConstraint6subCA0Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint Test11"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA1Cert
  crlImport pathLenConstraint6subCA1CRL.crl
  certImport pathLenConstraint6subsubCA11Cert
  crlImport pathLenConstraint6subsubCA11CRL.crl
  certImport pathLenConstraint6subsubsubCA11XCert
  crlImport pathLenConstraint6subsubsubCA11XCRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest11EE.crt \
      $certs/pathLenConstraint6subsubsubCA11XCert.crt \
      $certs/pathLenConstraint6subsubCA11Cert.crt \
      $certs/pathLenConstraint6subCA1Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

  VFY_ACTION="Invalid pathLenConstraint test12"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA1Cert
  crlImport pathLenConstraint6subCA1CRL.crl
  certImport pathLenConstraint6subsubCA11Cert
  crlImport pathLenConstraint6subsubCA11CRL.crl
  certImport pathLenConstraint6subsubsubCA11XCert
  crlImport pathLenConstraint6subsubsubCA11XCRL.crl
  pkitsn $certs/InvalidpathLenConstraintTest12EE.crt \
      $certs/pathLenConstraint6subsubsubCA11XCert.crt \
      $certs/pathLenConstraint6subsubCA11Cert.crt \
      $certs/pathLenConstraint6subCA1Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

  VFY_ACTION="Valid pathLenConstraint Test13"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA4Cert
  crlImport pathLenConstraint6subCA4CRL.crl
  certImport pathLenConstraint6subsubCA41Cert
  crlImport pathLenConstraint6subsubCA41CRL.crl
  certImport pathLenConstraint6subsubsubCA41XCert
  crlImport pathLenConstraint6subsubsubCA41XCRL.crl
  pkits $certs/ValidpathLenConstraintTest13EE.crt \
      $certs/pathLenConstraint6subsubsubCA41XCert.crt \
      $certs/pathLenConstraint6subsubCA41Cert.crt \
      $certs/pathLenConstraint6subCA4Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

  VFY_ACTION="Valid pathLenConstraint Test14"; log_banner
  certImport pathLenConstraint6CACert
  crlImport pathLenConstraint6CACRL.crl
  certImport pathLenConstraint6subCA4Cert
  crlImport pathLenConstraint6subCA4CRL.crl
  certImport pathLenConstraint6subsubCA41Cert
  crlImport pathLenConstraint6subsubCA41CRL.crl
  certImport pathLenConstraint6subsubsubCA41XCert
  crlImport pathLenConstraint6subsubsubCA41XCRL.crl
  pkits $certs/ValidpathLenConstraintTest14EE.crt \
      $certs/pathLenConstraint6subsubsubCA41XCert.crt \
      $certs/pathLenConstraint6subsubCA41Cert.crt \
      $certs/pathLenConstraint6subCA4Cert.crt \
      $certs/pathLenConstraint6CACert.crt
  restore_db

### bug 232737 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Self-Issued pathLenConstraint Test15"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  pkits $certs/ValidSelfIssuedpathLenConstraintTest15EE.crt \
      $certs/pathLenConstraint0SelfIssuedCACert.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db
fi

  VFY_ACTION="Invalid Self-Issued pathLenConstraint Test16"; log_banner
  certImport pathLenConstraint0CACert
  crlImport pathLenConstraint0CACRL.crl
  certImport pathLenConstraint0subCA2Cert
  crlImport pathLenConstraint0subCA2CRL.crl
  pkitsn $certs/InvalidSelfIssuedpathLenConstraintTest16EE.crt \
      $certs/pathLenConstraint0subCA2Cert.crt \
      $certs/pathLenConstraint0SelfIssuedCACert.crt \
      $certs/pathLenConstraint0CACert.crt
  restore_db

### bug 232737 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Self-Issued pathLenConstraint Test17"; log_banner
  certImport pathLenConstraint1CACert
  crlImport pathLenConstraint1CACRL.crl
  certImport pathLenConstraint1subCACert
  crlImport pathLenConstraint1subCACRL.crl
  pkits $certs/ValidSelfIssuedpathLenConstraintTest17EE.crt \
      $certs/pathLenConstraint1SelfIssuedsubCACert.crt \
      $certs/pathLenConstraint1subCACert.crt \
      $certs/pathLenConstraint1SelfIssuedCACert.crt \
      $certs/pathLenConstraint1CACert.crt
  restore_db
fi
}

pkits_KeyUsage()
{
  break_table "NIST PKITS Section 4.7: Key Usage"

  VFY_ACTION="Invalid keyUsage Critical keyCertSign False Test1"; log_banner
  certImport keyUsageCriticalkeyCertSignFalseCACert
  crlImport keyUsageCriticalkeyCertSignFalseCACRL.crl
  pkitsn $certs/InvalidkeyUsageCriticalkeyCertSignFalseTest1EE.crt \
      $certs/keyUsageCriticalkeyCertSignFalseCACert.crt
  restore_db

  VFY_ACTION="Invalid keyUsage Not Critical keyCertSign False Test2"; log_banner
  certImport keyUsageNotCriticalkeyCertSignFalseCACert
  crlImport keyUsageNotCriticalkeyCertSignFalseCACRL.crl
  pkitsn $certs/InvalidkeyUsageNotCriticalkeyCertSignFalseTest2EE.crt \
      $certs/keyUsageNotCriticalkeyCertSignFalseCACert.crt
  restore_db

  VFY_ACTION="Valid keyUsage Not Critical Test3"; log_banner
  certImport keyUsageNotCriticalCACert
  crlImport keyUsageNotCriticalCACRL.crl
  pkits $certs/ValidkeyUsageNotCriticalTest3EE.crt \
      $certs/keyUsageNotCriticalCACert.crt
  restore_db

  VFY_ACTION="Invalid keyUsage Critical cRLSign False Test4"; log_banner
  certImport keyUsageCriticalcRLSignFalseCACert
  crlImportn keyUsageCriticalcRLSignFalseCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidkeyUsageCriticalcRLSignFalseTest4EE.crt \
          $certs/keyUsageCriticalcRLSignFalseCACert.crt
  fi
  restore_db

  VFY_ACTION="Invalid keyUsage Not Critical cRLSign False Test5"; log_banner
  certImport keyUsageNotCriticalcRLSignFalseCACert
  crlImportn keyUsageNotCriticalcRLSignFalseCACRL.crl
  if [ $RET -eq 0 ] ; then 
      pkitsn $certs/InvalidkeyUsageNotCriticalcRLSignFalseTest5EE.crt \
          $certs/keyUsageNotCriticalcRLSignFalseCACert.crt
  fi
  restore_db
}

pkits_CertificatePolicies()
{
  break_table "NIST PKITS Section 4.8: Certificate Policies"

  VFY_ACTION="All Certificates Same Policy Test1"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/ValidCertificatePathTest1EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="All Certificates No Policies Test2"; log_banner
  certImport NoPoliciesCACert
  crlImport NoPoliciesCACRL.crl
  pkits $certs/AllCertificatesNoPoliciesTest2EE.crt \
      $certs/NoPoliciesCACert.crt
  restore_db

  VFY_ACTION="Different Policies Test3"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  certImport PoliciesP2subCACert
  crlImport PoliciesP2subCACRL.crl
  pkits $certs/DifferentPoliciesTest3EE.crt \
      $certs/PoliciesP2subCACert.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Different Policies Test4"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  certImport GoodsubCACert
  crlImport GoodsubCACRL.crl
  pkits $certs/DifferentPoliciesTest4EE.crt \
      $certs/GoodsubCACert.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Different Policies Test5"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  certImport PoliciesP2subCA2Cert
  crlImport PoliciesP2subCA2CRL.crl
  pkits $certs/DifferentPoliciesTest5EE.crt \
      $certs/PoliciesP2subCA2Cert.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Overlapping Policies Test6"; log_banner
  certImport PoliciesP1234CACert
  crlImport PoliciesP1234CACRL.crl
  certImport PoliciesP1234subCAP123Cert
  crlImport PoliciesP1234subCAP123CRL.crl
  certImport PoliciesP1234subsubCAP123P12Cert
  crlImport PoliciesP1234subsubCAP123P12CRL.crl
  pkits $certs/OverlappingPoliciesTest6EE.crt \
      $certs/PoliciesP1234subsubCAP123P12Cert.crt \
      $certs/PoliciesP1234subCAP123Cert.crt \
      $certs/PoliciesP1234CACert.crt
  restore_db

  VFY_ACTION="Different Policies Test7"; log_banner
  certImport PoliciesP123CACert
  crlImport PoliciesP123CACRL.crl
  certImport PoliciesP123subCAP12Cert
  crlImport PoliciesP123subCAP12CRL.crl
  certImport PoliciesP123subsubCAP12P1Cert
  crlImport PoliciesP123subsubCAP12P1CRL.crl
  pkits $certs/DifferentPoliciesTest7EE.crt \
      $certs/PoliciesP123subsubCAP12P1Cert.crt \
      $certs/PoliciesP123subCAP12Cert.crt \
      $certs/PoliciesP123CACert.crt
  restore_db

  VFY_ACTION="Different Policies Test8"; log_banner
  certImport PoliciesP12CACert
  crlImport PoliciesP12CACRL.crl
  certImport PoliciesP12subCAP1Cert
  crlImport PoliciesP12subCAP1CRL.crl
  certImport PoliciesP12subsubCAP1P2Cert
  crlImport PoliciesP12subsubCAP1P2CRL.crl
  pkits $certs/DifferentPoliciesTest8EE.crt \
      $certs/PoliciesP123subsubCAP12P1Cert.crt \
      $certs/PoliciesP12subCAP1Cert.crt \
      $certs/PoliciesP12CACert.crt
  restore_db

  VFY_ACTION="Different Policies Test9"; log_banner
  certImport PoliciesP123CACert
  crlImport PoliciesP123CACRL.crl
  certImport PoliciesP123subCAP12Cert
  crlImport PoliciesP123subCAP12CRL.crl
  certImport PoliciesP123subsubCAP12P2Cert
  crlImport PoliciesP123subsubCAP2P2CRL.crl
  certImport PoliciesP123subsubsubCAP12P2P1Cert
  crlImport PoliciesP123subsubsubCAP12P2P1CRL.crl
  pkits $certs/DifferentPoliciesTest9EE.crt \
      $certs/PoliciesP123subsubsubCAP12P2P1Cert.crt \
      $certs/PoliciesP123subsubCAP12P1Cert.crt \
      $certs/PoliciesP12subCAP1Cert.crt \
      $certs/PoliciesP12CACert.crt
  restore_db

  VFY_ACTION="All Certificates Same Policies Test10"; log_banner
  certImport PoliciesP12CACert
  crlImport PoliciesP12CACRL.crl
  pkits $certs/AllCertificatesSamePoliciesTest10EE.crt \
      $certs/NoPoliciesCACert.crt
  restore_db

  VFY_ACTION="All Certificates AnyPolicy Test11"; log_banner
  certImport anyPolicyCACert
  crlImport anyPolicyCACRL.crl
  pkits $certs/AllCertificatesanyPolicyTest11EE.crt \
      $certs/anyPolicyCACert.crt
  restore_db

  VFY_ACTION="Different Policies Test12"; log_banner
  certImport PoliciesP3CACert
  crlImport PoliciesP3CACRL.crl
  pkits $certs/DifferentPoliciesTest12EE.crt \
      $certs/PoliciesP3CACert.crt
  restore_db

  VFY_ACTION="All Certificates Same Policies Test13"; log_banner
  certImport PoliciesP123CACert
  crlImport PoliciesP123CACRL.crl
  pkits $certs/AllCertificatesSamePoliciesTest13EE.crt \
      $certs/PoliciesP123CACert.crt
  restore_db

  VFY_ACTION="AnyPolicy Test14"; log_banner
  certImport anyPolicyCACert
  crlImport anyPolicyCACRL.crl
  pkits $certs/AnyPolicyTest14EE.crt \
      $certs/anyPolicyCACert.crt
  restore_db

  VFY_ACTION="User Notice Qualifier Test15"; log_banner
  pkits $certs/UserNoticeQualifierTest15EE.crt

  VFY_ACTION="User Notice Qualifier Test16"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/UserNoticeQualifierTest16EE.crt \
      $certs/GoodCACert.crt

  VFY_ACTION="User Notice Qualifier Test17"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/UserNoticeQualifierTest17EE.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="User Notice Qualifier Test18"; log_banner
  certImport PoliciesP12CACert
  crlImport PoliciesP12CACRL.crl
  pkits $certs/UserNoticeQualifierTest18EE.crt \
      $certs/PoliciesP12CACert.crt
  restore_db

  VFY_ACTION="User Notice Qualifier Test19"; log_banner
  pkits $certs/UserNoticeQualifierTest19EE.crt

  VFY_ACTION="CPS Pointer Qualifier Test20"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  pkits $certs/CPSPointerQualifierTest20EE.crt \
      $certs/GoodCACert.crt
  restore_db
}

pkits_RequireExplicitPolicy()
{
  break_table "NIST PKITS Section 4.9: Require Explicit Policy"

  VFY_ACTION="Valid RequireExplicitPolicy Test1"; log_banner
  certImportn requireExplicitPolicy10CACert
  crlImportn requireExplicitPolicy10CACRL.crl
  certImport requireExplicitPolicy10subCACert
  crlImport requireExplicitPolicy10subCACRL.crl
  certImport requireExplicitPolicy10subsubCACert
  crlImport requireExplicitPolicy10subsubCACRL.crl
  certImport requireExplicitPolicy10subsubsubCACert
  crlImport requireExplicitPolicy10subsubsubCACRL.crl
  pkits $certs/ValidrequireExplicitPolicyTest1EE.crt \
      $certs/requireExplicitPolicy10subsubsubCACert.crt \
      $certs/requireExplicitPolicy10subsubCACert.crt \
      $certs/requireExplicitPolicy10subCACert.crt \
      $certs/requireExplicitPolicy10CACert.crt
  restore_db

  VFY_ACTION="Valid RequireExplicitPolicy Test2"; log_banner
  certImportn requireExplicitPolicy5CACert
  crlImportn requireExplicitPolicy5CACRL.crl
  certImport requireExplicitPolicy5subCACert
  crlImport requireExplicitPolicy5subCACRL.crl
  certImport requireExplicitPolicy5subsubCACert
  crlImport requireExplicitPolicy5subsubCACRL.crl
  certImport requireExplicitPolicy5subsubsubCACert
  crlImport requireExplicitPolicy5subsubsubCACRL.crl
  pkits $certs/ValidrequireExplicitPolicyTest2EE.crt \
      $certs/requireExplicitPolicy5subsubsubCACert.crt \
      $certs/requireExplicitPolicy5subsubCACert.crt \
      $certs/requireExplicitPolicy5subCACert.crt \
      $certs/requireExplicitPolicy5CACert.crt
  restore_db

  VFY_ACTION="Invalid RequireExplicitPolicy Test3"; log_banner
  certImportn requireExplicitPolicy4CACert
  crlImportn requireExplicitPolicy4CACRL.crl
  certImport requireExplicitPolicy4subCACert
  crlImport requireExplicitPolicy4subCACRL.crl
  certImport requireExplicitPolicy4subsubCACert
  crlImport requireExplicitPolicy4subsubCACRL.crl
  certImport requireExplicitPolicy4subsubsubCACert
  crlImport requireExplicitPolicy4subsubsubCACRL.crl
  pkitsn $certs/InvalidrequireExplicitPolicyTest3EE.crt \
      $certs/requireExplicitPolicy4subsubsubCACert.crt \
      $certs/requireExplicitPolicy4subsubCACert.crt \
      $certs/requireExplicitPolicy4subCACert.crt \
      $certs/requireExplicitPolicy4CACert.crt
  restore_db

  VFY_ACTION="Valid RequireExplicitPolicy Test4"; log_banner
  certImportn requireExplicitPolicy0CACert
  crlImportn requireExplicitPolicy0CACRL.crl
  certImport requireExplicitPolicy0subCACert
  crlImport requireExplicitPolicy0subCACRL.crl
  certImport requireExplicitPolicy0subsubCACert
  crlImport requireExplicitPolicy0subsubCACRL.crl
  certImport requireExplicitPolicy0subsubsubCACert
  crlImport requireExplicitPolicy0subsubsubCACRL.crl
  pkits $certs/ValidrequireExplicitPolicyTest4EE.crt \
      $certs/requireExplicitPolicy0subsubsubCACert.crt \
      $certs/requireExplicitPolicy0subsubCACert.crt \
      $certs/requireExplicitPolicy0subCACert.crt \
      $certs/requireExplicitPolicy0CACert.crt
  restore_db

  VFY_ACTION="Invalid RequireExplicitPolicy Test5"; log_banner
  certImportn requireExplicitPolicy7CACert
  crlImportn requireExplicitPolicy7CACRL.crl
  certImportn requireExplicitPolicy7subCARE2Cert
  crlImportn requireExplicitPolicy7subCARE2CRL.crl
  certImportn requireExplicitPolicy7subsubCARE2RE4Cert
  crlImportn requireExplicitPolicy7subsubCARE2RE4CRL.crl
  certImport requireExplicitPolicy7subsubsubCARE2RE4Cert
  crlImport requireExplicitPolicy7subsubsubCARE2RE4CRL.crl
  pkitsn $certs/InvalidrequireExplicitPolicyTest5EE.crt \
      $certs/requireExplicitPolicy7subsubsubCARE2RE4Cert.crt \
      $certs/requireExplicitPolicy7subsubCARE2RE4Cert.crt \
      $certs/requireExplicitPolicy7subCARE2Cert.crt \
      $certs/requireExplicitPolicy7CACert.crt
  restore_db

  VFY_ACTION="Valid Self-Issued RequireExplicitPolicy Test6"; log_banner
  certImportn requireExplicitPolicy2CACert
  crlImportn requireExplicitPolicy2CACRL.crl
  pkits $certs/ValidSelfIssuedrequireExplicitPolicyTest6EE.crt \
      $certs/requireExplicitPolicy2SelfIssuedCACert.crt \
      $certs/requireExplicitPolicy2CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued RequireExplicitPolicy Test7"; log_banner
  certImportn requireExplicitPolicy2CACert
  crlImportn requireExplicitPolicy2CACRL.crl
  certImport requireExplicitPolicy2subCACert
  crlImport requireExplicitPolicy2subCACRL.crl
  pkitsn $certs/InvalidSelfIssuedrequireExplicitPolicyTest7EE.crt \
      $certs/requireExplicitPolicy2subCACert.crt \
      $certs/requireExplicitPolicy2SelfIssuedCACert.crt \
      $certs/requireExplicitPolicy2CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued RequireExplicitPolicy Test8"; log_banner
  certImportn requireExplicitPolicy2CACert
  crlImportn requireExplicitPolicy2CACRL.crl
  certImport requireExplicitPolicy2subCACert
  crlImport requireExplicitPolicy2subCACRL.crl
  pkitsn $certs/InvalidSelfIssuedrequireExplicitPolicyTest8EE.crt \
      $certs/requireExplicitPolicy2SelfIssuedsubCACert.crt \
      $certs/requireExplicitPolicy2subCACert.crt \
      $certs/requireExplicitPolicy2SelfIssuedCACert.crt \
      $certs/requireExplicitPolicy2CACert.crt
  restore_db
}

pkits_PolicyMappings()
{
  break_table "NIST PKITS Section 4.10: Policy Mappings"

  VFY_ACTION="Valid Policy Mapping Test1"; log_banner
  certImportn Mapping1to2CACert
  crlImportn Mapping1to2CACRL.crl
  pkits $certs/ValidPolicyMappingTest1EE.crt \
      $certs/Mapping1to2CACert.crt
  restore_db

  VFY_ACTION="Invalid Policy Mapping Test2"; log_banner
  certImportn Mapping1to2CACert
  crlImportn Mapping1to2CACRL.crl
  pkitsn $certs/InvalidPolicyMappingTest2EE.crt \
      $certs/Mapping1to2CACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test3"; log_banner
  certImportn P12Mapping1to3CACert
  crlImportn P12Mapping1to3CACRL.crl
  certImportn P12Mapping1to3subCACert
  crlImportn P12Mapping1to3subCACRL.crl
  certImportn P12Mapping1to3subsubCACert
  crlImportn P12Mapping1to3subsubCACRL.crl
  pkits $certs/ValidPolicyMappingTest3EE.crt \
      $certs/P12Mapping1to3subsubCACert.crt \
      $certs/P12Mapping1to3subCACert.crt \
      $certs/P12Mapping1to3CA.crt
  restore_db

  VFY_ACTION="Invalid Policy Mapping Test4"; log_banner
  certImportn P12Mapping1to3CACert
  crlImportn P12Mapping1to3CACRL.crl
  certImportn P12Mapping1to3subCACert
  crlImportn P12Mapping1to3subCACRL.crl
  certImportn P12Mapping1to3subsubCACert
  crlImportn P12Mapping1to3subsubCACRL.crl
  pkitsn $certs/InvalidPolicyMappingTest4EE.crt \
      $certs/P12Mapping1to3subsubCACert.crt \
      $certs/P12Mapping1to3subCACert.crt \
      $certs/P12Mapping1to3CA.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test5"; log_banner
  certImportn P1Mapping1to234CACert
  crlImportn P1Mapping1to234CACRL.crl
  certImportn P1Mapping1to234subCACert
  crlImportn P1Mapping1to234subCACRL.crl
  pkits $certs/ValidPolicyMappingTest5EE.crt \
      $certs/P1Mapping1to234subCACert.crt \
      $certs/P1Mapping1to234CA.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test6"; log_banner
  certImportn P1Mapping1to234CACert
  crlImportn P1Mapping1to234CACRL.crl
  certImportn P1Mapping1to234subCACert
  crlImportn P1Mapping1to234subCACRL.crl
  pkits $certs/ValidPolicyMappingTest6EE.crt \
      $certs/P1Mapping1to234subCACert.crt \
      $certs/P1Mapping1to234CA.crt
  restore_db

  VFY_ACTION="Invalid Mapping from anyPolicy Test7"; log_banner
  certImportn MappingFromanyPolicyCACert
  crlImportn MappingFromanyPolicyCACRL.crl
  pkitsn $certs/InvalidMappingFromanyPolicyTest7EE.crt \
      $certs/MappingFromanyPolicyCACert.crt
  restore_db

  VFY_ACTION="Invalid Mapping to anyPolicy Test8"; log_banner
  certImportn MappingToanyPolicyCACert
  crlImportn MappingToanyPolicyCACRL.crl
  pkitsn $certs/InvalidMappingToanyPolicyTest8EE.crt \
      $certs/MappingToanyPolicyCACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test9"; log_banner
  certImport PanyPolicyMapping1to2CACert
  crlImport PanyPolicyMapping1to2CACRL.crl
  pkits $certs/ValidPolicyMappingTest9EE.crt \
      $certs/PanyPolicyMapping1to2CACert.crt
  restore_db

  VFY_ACTION="Invalid Policy Mapping Test10"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  certImportn GoodsubCAPanyPolicyMapping1to2CACert
  crlImportn GoodsubCAPanyPolicyMapping1to2CACRL.crl
  pkitsn $certs/InvalidPolicyMappingTest10EE.crt \
      $certs/GoodsubCAPanyPolicyMapping1to2CACert.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test11"; log_banner
  certImport GoodCACert
  crlImport GoodCACRL.crl
  certImportn GoodsubCAPanyPolicyMapping1to2CACert
  crlImportn GoodsubCAPanyPolicyMapping1to2CACRL.crl
  pkits $certs/ValidPolicyMappingTest11EE.crt \
      $certs/GoodsubCAPanyPolicyMapping1to2CACert.crt \
      $certs/GoodCACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test12"; log_banner
  certImportn P12Mapping1to3CACert
  crlImportn P12Mapping1to3CACRL.crl
  pkits $certs/ValidPolicyMappingTest12EE.crt \
      $certs/P12Mapping1to3CACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test13"; log_banner
  certImportn P1anyPolicyMapping1to2CACert
  crlImportn P1anyPolicyMapping1to2CACRL.crl
  pkits $certs/ValidPolicyMappingTest13EE.crt \
      $certs/P1anyPolicyMapping1to2CACert.crt
  restore_db

  VFY_ACTION="Valid Policy Mapping Test14"; log_banner
  certImportn P1anyPolicyMapping1to2CACert
  crlImportn P1anyPolicyMapping1to2CACRL.crl
  pkits $certs/ValidPolicyMappingTest14EE.crt \
      $certs/P1anyPolicyMapping1to2CACert.crt
  restore_db
}


pkits_InhibitPolicyMapping()
{
  break_table "NIST PKITS Section 4.11: Inhibit Policy Mapping"

  VFY_ACTION="Invalid inhibitPolicyMapping Test1"; log_banner
  certImportn inhibitPolicyMapping0CACert
  crlImportn inhibitPolicyMapping0CACRL.crl
  certImportn inhibitPolicyMapping0subCACert
  crlImportn inhibitPolicyMapping0subCACRL.crl
  pkitsn $certs/InvalidinhibitPolicyMappingTest1EE.crt \
      $certs/inhibitPolicyMapping0CACert.crt \
      $certs/inhibitPolicyMapping0subCACert.crt
  restore_db

  VFY_ACTION="Valid inhibitPolicyMapping Test2"; log_banner
  certImportn inhibitPolicyMapping1P12CACert
  crlImportn inhibitPolicyMapping1P12CACRL.crl
  certImportn inhibitPolicyMapping1P12subCACert
  crlImportn inhibitPolicyMapping1P12subCACRL.crl
  pkits $certs/ValidinhibitPolicyMappingTest2EE.crt \
      $certs/inhibitPolicyMapping1P12CACert.crt \
      $certs/inhibitPolicyMapping1P12subCACert.crt
  restore_db

  VFY_ACTION="Invalid inhibitPolicyMapping Test3"; log_banner
  certImportn inhibitPolicyMapping1P12CACert
  crlImportn inhibitPolicyMapping1P12CACRL.crl
  certImportn inhibitPolicyMapping1P12subCACert
  crlImportn inhibitPolicyMapping1P12subCACRL.crl
  certImportn inhibitPolicyMapping1P12subsubCACert
  crlImportn inhibitPolicyMapping1P12subsubCACRL.crl
  pkitsn $certs/InvalidinhibitPolicyMappingTest3EE.crt \
      $certs/inhibitPolicyMapping1P12subsubCACert.crt \
      $certs/inhibitPolicyMapping1P12subCACert.crt \
      $certs/inhibitPolicyMapping1P12CACert.crt
  restore_db

  VFY_ACTION="Valid inhibitPolicyMapping Test4"; log_banner
  certImportn inhibitPolicyMapping1P12CACert
  crlImportn inhibitPolicyMapping1P12CACRL.crl
  certImportn inhibitPolicyMapping1P12subCACert
  crlImportn inhibitPolicyMapping1P12subCACRL.crl
  certImportn inhibitPolicyMapping1P12subsubCACert
  crlImportn inhibitPolicyMapping1P12subsubCACRL.crl
  pkits $certs/ValidinhibitPolicyMappingTest4EE.crt \
      $certs/inhibitPolicyMapping1P12CACert.crt \
      $certs/inhibitPolicyMapping1P12subCACert.crt
  restore_db

  VFY_ACTION="Invalid inhibitPolicyMapping Test5"; log_banner
  certImportn inhibitPolicyMapping5CACert
  crlImportn inhibitPolicyMapping5CACRL.crl
  certImportn inhibitPolicyMapping5subCACert
  crlImportn inhibitPolicyMapping5subCACRL.crl
  certImport inhibitPolicyMapping5subsubCACert
  crlImport inhibitPolicyMapping5subsubCACRL.crl
  pkitsn $certs/InvalidinhibitPolicyMappingTest5EE.crt \
      $certs/inhibitPolicyMapping5subsubCACert.crt \
      $certs/inhibitPolicyMapping5subCACert.crt \
      $certs/inhibitPolicyMapping5CACert.crt
  restore_db

  VFY_ACTION="Invalid inhibitPolicyMapping Test6"; log_banner
  certImportn inhibitPolicyMapping1P12CACert
  crlImportn inhibitPolicyMapping1P12CACRL.crl
  certImportn inhibitPolicyMapping1P12subCAIPM5Cert
  crlImportn inhibitPolicyMapping1P12subCAIPM5CRL.crl
  certImport inhibitPolicyMapping1P12subsubCAIPM5Cert
  crlImportn inhibitPolicyMapping1P12subsubCAIPM5CRL.crl
  pkitsn $certs/InvalidinhibitPolicyMappingTest6EE.crt \
      $certs/inhibitPolicyMapping1P12subsubCAIPM5Cert.crt \
      $certs/inhibitPolicyMapping1P12subCAIPM5Cert.crt \
      $certs/inhibitPolicyMapping1P12CACert.crt
  restore_db

  VFY_ACTION="Valid Self-Issued inhibitPolicyMapping Test7"; log_banner
  certImportn inhibitPolicyMapping1P1CACert
  crlImportn inhibitPolicyMapping1P1CACRL.crl
  certImportn inhibitPolicyMapping1P1subCACert
  crlImportn inhibitPolicyMapping1P1subCACRL.crl
  pkits $certs/ValidSelfIssuedinhibitPolicyMappingTest7EE.crt \
      $certs/inhibitPolicyMapping1P1subCACert.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt \
      $certs/inhibitPolicyMapping1P1CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitPolicyMapping Test8"; log_banner
  certImportn inhibitPolicyMapping1P1CACert
  crlImportn inhibitPolicyMapping1P1CACRL.crl
  certImportn inhibitPolicyMapping1P1subCACert
  crlImportn inhibitPolicyMapping1P1subCACRL.crl
  certImport inhibitPolicyMapping1P1subsubCACert
  crlImportn inhibitPolicyMapping1P1subsubCACRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitPolicyMappingTest8EE.crt \
      $certs/inhibitPolicyMapping1P1subsubCACert.crt \
      $certs/inhibitPolicyMapping1P1subCACert.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt \
      $certs/inhibitPolicyMapping1P1CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitPolicyMapping Test9"; log_banner
  certImportn inhibitPolicyMapping1P1CACert
  crlImportn inhibitPolicyMapping1P1CACRL.crl
  certImportn inhibitPolicyMapping1P1subCACert
  crlImportn inhibitPolicyMapping1P1subCACRL.crl
  certImportn inhibitPolicyMapping1P1subsubCACert
  crlImportn inhibitPolicyMapping1P1subsubCACRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitPolicyMappingTest9EE.crt \
      $certs/inhibitPolicyMapping1P1subsubCACert.crt \
      $certs/inhibitPolicyMapping1P1subCACert.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt \
      $certs/inhibitPolicyMapping1P1CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitPolicyMapping Test10"; log_banner
  certImportn inhibitPolicyMapping1P1CACert
  crlImportn inhibitPolicyMapping1P1CACRL.crl
  certImportn inhibitPolicyMapping1P1subCACert
  crlImportn inhibitPolicyMapping1P1subCACRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitPolicyMappingTest10EE.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedsubCACert.crt \
      $certs/inhibitPolicyMapping1P1subCACert.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt \
      $certs/inhibitPolicyMapping1P1CACert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitPolicyMapping Test11"; log_banner
  certImportn inhibitPolicyMapping1P1CACert
  crlImportn inhibitPolicyMapping1P1CACRL.crl
  certImportn inhibitPolicyMapping1P1subCACert
  crlImportn inhibitPolicyMapping1P1subCACRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitPolicyMappingTest11EE.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedsubCACert.crt \
      $certs/inhibitPolicyMapping1P1subCACert.crt \
      $certs/inhibitPolicyMapping1P1SelfIssuedCACert.crt \
      $certs/inhibitPolicyMapping1P1CACert.crt
  restore_db
}


pkits_InhibitAnyPolicy()
{
  break_table "NIST PKITS Section 4.12: Inhibit Any Policy"

  VFY_ACTION="Invalid inhibitAnyPolicy Test1"; log_banner
  certImportn inhibitAnyPolicy0CACert
  crlImportn inhibitAnyPolicy0CACRL.crl
  pkitsn $certs/InvalidinhibitAnyPolicyTest1EE.crt \
      $certs/inhibitAnyPolicy0CACert.crt
  restore_db

  VFY_ACTION="Valid inhibitAnyPolicy Test2"; log_banner
  certImportn inhibitAnyPolicy0CACert
  crlImportn inhibitAnyPolicy0CACRL.crl
  pkits $certs/ValidinhibitAnyPolicyTest2EE.crt \
      $certs/inhibitAnyPolicy0CACert.crt
  restore_db

  VFY_ACTION="inhibitAnyPolicy Test3"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA1Cert
  crlImport inhibitAnyPolicy1subCA1CRL.crl
  pkits $certs/inhibitAnyPolicyTest3EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1subCA1Cert.crt
  restore_db

  VFY_ACTION="Invalid inhibitAnyPolicy Test4"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA1Cert
  crlImport inhibitAnyPolicy1subCA1CRL.crl
  pkitsn $certs/InvalidinhibitAnyPolicyTest4EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1subCA1Cert.crt
  restore_db

  VFY_ACTION="Invalid inhibitAnyPolicy Test5"; log_banner
  certImportn inhibitAnyPolicy5CACert
  crlImportn inhibitAnyPolicy5CACRL.crl
  certImportn inhibitAnyPolicy5subCACert
  crlImportn inhibitAnyPolicy5subCACRL.crl
  certImport inhibitAnyPolicy5subsubCACert
  crlImport inhibitAnyPolicy5subsubCACRL.crl
  pkitsn $certs/InvalidinhibitAnyPolicyTest5EE.crt \
      $certs/inhibitAnyPolicy5CACert.crt \
      $certs/inhibitAnyPolicy5subCACert.crt \
      $certs/inhibitAnyPolicy5subsubCACert.crt
  restore_db

  VFY_ACTION="Invalid inhibitAnyPolicy Test6"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImportn inhibitAnyPolicy1subCAIAP5Cert
  crlImportn inhibitAnyPolicy1subCAIAP5CRL.crl
  pkitsn $certs/InvalidinhibitAnyPolicyTest5EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy5subCACert.crt \
      $certs/inhibitAnyPolicy5subsubCACert.crt
  restore_db

  VFY_ACTION="Valid Self-Issued inhibitAnyPolicy Test7"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA2Cert
  crlImport inhibitAnyPolicy1subCA2CRL.crl
  pkits $certs/ValidSelfIssuedinhibitAnyPolicyTest7EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1SelfIssuedCACert.crt \
      $certs/inhibitAnyPolicy1subCA2Cert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitAnyPolicy Test8"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA2Cert
  crlImport inhibitAnyPolicy1subCA2CRL.crl
  certImport inhibitAnyPolicy1subsubCA2Cert
  crlImport inhibitAnyPolicy1subsubCA2CRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitAnyPolicyTest8EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1SelfIssuedCACert.crt \
      $certs/inhibitAnyPolicy1subCA2Cert.crt \
      $certs/inhibitAnyPolicy1subsubCA2Cert.crt
  restore_db

  VFY_ACTION="Valid Self-Issued inhibitAnyPolicy Test9"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA2Cert
  crlImport inhibitAnyPolicy1subCA2CRL.crl
  pkits $certs/ValidSelfIssuedinhibitAnyPolicyTest9EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1SelfIssuedCACert.crt \
      $certs/inhibitAnyPolicy1subCA2Cert.crt \
      $certs/inhibitAnyPolicy1SelfIssuedsubCA2Cert.crt
  restore_db

  VFY_ACTION="Invalid Self-Issued inhibitAnyPolicy Test10"; log_banner
  certImportn inhibitAnyPolicy1CACert
  crlImportn inhibitAnyPolicy1CACRL.crl
  certImport inhibitAnyPolicy1subCA2Cert
  crlImport inhibitAnyPolicy1subCA2CRL.crl
  pkitsn $certs/InvalidSelfIssuedinhibitAnyPolicyTest10EE.crt \
      $certs/inhibitAnyPolicy1CACert.crt \
      $certs/inhibitAnyPolicy1SelfIssuedCACert.crt \
      $certs/inhibitAnyPolicy1subCA2Cert.crt
  restore_db
}


pkits_NameConstraints()
{
  break_table "NIST PKITS Section 4.13: Name Constraints"

  VFY_ACTION="Valid DN nameConstraints Test1"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest1EE.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test2"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest2EE.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test3"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest3EE.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test4"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest4EE.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test5"; log_banner
  certImport nameConstraintsDN2CACert
  crlImport nameConstraintsDN2CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest5EE.crt \
      $certs/nameConstraintsDN2CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test6"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest6EE.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test7"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest7EE.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test8"; log_banner
  certImport nameConstraintsDN4CACert
  crlImport nameConstraintsDN4CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest8EE.crt \
      $certs/nameConstraintsDN4CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test9"; log_banner
  certImport nameConstraintsDN4CACert
  crlImport nameConstraintsDN4CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest9EE.crt \
      $certs/nameConstraintsDN4CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test10"; log_banner
  certImport nameConstraintsDN5CACert
  crlImport nameConstraintsDN5CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest10EE.crt \
      $certs/nameConstraintsDN5CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test11"; log_banner
  certImport nameConstraintsDN5CACert
  crlImport nameConstraintsDN5CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest11EE.crt \
      $certs/nameConstraintsDN5CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test12"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA1Cert
  crlImport nameConstraintsDN1subCA1CRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest12EE.crt \
      $certs/nameConstraintsDN1subCA1Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test13"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA2Cert
  crlImport nameConstraintsDN1subCA2CRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest13EE.crt \
      $certs/nameConstraintsDN1subCA2Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test14"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA2Cert
  crlImport nameConstraintsDN1subCA2CRL.crl
  pkits $certs/ValidDNnameConstraintsTest14EE.crt \
      $certs/nameConstraintsDN1subCA2Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test15"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  certImport nameConstraintsDN3subCA1Cert
  crlImport nameConstraintsDN3subCA1CRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest15EE.crt \
      $certs/nameConstraintsDN3subCA1Cert.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test16"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  certImport nameConstraintsDN3subCA1Cert
  crlImport nameConstraintsDN3subCA1CRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest16EE.crt \
      $certs/nameConstraintsDN3subCA1Cert.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

  VFY_ACTION="Invalid DN nameConstraints Test17"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  certImport nameConstraintsDN3subCA2Cert
  crlImport nameConstraintsDN3subCA2CRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest17EE.crt \
      $certs/nameConstraintsDN3subCA2Cert.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

  VFY_ACTION="Valid DN nameConstraints Test18"; log_banner
  certImport nameConstraintsDN3CACert
  crlImport nameConstraintsDN3CACRL.crl
  certImport nameConstraintsDN3subCA2Cert
  crlImport nameConstraintsDN3subCA2CRL.crl
  pkits $certs/ValidDNnameConstraintsTest18EE.crt \
      $certs/nameConstraintsDN3subCA2Cert.crt \
      $certs/nameConstraintsDN3CACert.crt
  restore_db

### bug 232737 ###
if [ -n "${KNOWN_BUG}" ]; then
  VFY_ACTION="Valid Self-Issued DN nameConstraints Test19"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkits $certs/ValidDNnameConstraintsTest19EE.crt \
      $certs/nameConstraintsDN1SelfIssuedCACert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db
fi

  VFY_ACTION="Invalid Self-Issued DN nameConstraints Test20"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  pkitsn $certs/InvalidDNnameConstraintsTest20EE.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Valid RFC822 nameConstraints Test21"; log_banner
  certImport nameConstraintsRFC822CA1Cert
  crlImport nameConstraintsRFC822CA1CRL.crl
  pkits $certs/ValidRFC822nameConstraintsTest21EE.crt \
      $certs/nameConstraintsRFC822CA1Cert.crt
  restore_db

  VFY_ACTION="Invalid RFC822 nameConstraints Test22"; log_banner
  certImport nameConstraintsRFC822CA1Cert
  crlImport nameConstraintsRFC822CA1CRL.crl
  pkitsn $certs/InvalidRFC822nameConstraintsTest22EE.crt \
      $certs/nameConstraintsRFC822CA1Cert.crt
  restore_db

  VFY_ACTION="Valid RFC822 nameConstraints Test23"; log_banner
  certImport nameConstraintsRFC822CA2Cert
  crlImport nameConstraintsRFC822CA2CRL.crl
  pkits $certs/ValidRFC822nameConstraintsTest23EE.crt \
      $certs/nameConstraintsRFC822CA2Cert.crt
  restore_db

  VFY_ACTION="Invalid RFC822 nameConstraints Test24"; log_banner
  certImport nameConstraintsRFC822CA2Cert
  crlImport nameConstraintsRFC822CA2CRL.crl
  pkitsn $certs/InvalidRFC822nameConstraintsTest24EE.crt \
      $certs/nameConstraintsRFC822CA2Cert.crt
  restore_db

  VFY_ACTION="Valid RFC822 nameConstraints Test25"; log_banner
  certImport nameConstraintsRFC822CA3Cert
  crlImport nameConstraintsRFC822CA3CRL.crl
  pkits $certs/ValidRFC822nameConstraintsTest25EE.crt \
      $certs/nameConstraintsRFC822CA3Cert.crt
  restore_db

  VFY_ACTION="Invalid RFC822 nameConstraints Test26"; log_banner
  certImport nameConstraintsRFC822CA3Cert
  crlImport nameConstraintsRFC822CA3CRL.crl
  pkitsn $certs/InvalidRFC822nameConstraintsTest26EE.crt \
      $certs/nameConstraintsRFC822CA3Cert.crt
  restore_db

  VFY_ACTION="Valid DN and RFC822 nameConstraints Test27"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA3Cert
  crlImport nameConstraintsDN1subCA3CRL.crl
  pkits $certs/ValidDNandRFC822nameConstraintsTest27EE.crt \
      $certs/nameConstraintsDN1subCA3Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN and RFC822 nameConstraints Test28"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA3Cert
  crlImport nameConstraintsDN1subCA3CRL.crl
  pkitsn $certs/InvalidDNandRFC822nameConstraintsTest28EE.crt \
      $certs/nameConstraintsDN1subCA3Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Invalid DN and RFC822 nameConstraints Test29"; log_banner
  certImport nameConstraintsDN1CACert
  crlImport nameConstraintsDN1CACRL.crl
  certImport nameConstraintsDN1subCA3Cert
  crlImport nameConstraintsDN1subCA3CRL.crl
  pkitsn $certs/InvalidDNandRFC822nameConstraintsTest29EE.crt \
      $certs/nameConstraintsDN1subCA3Cert.crt \
      $certs/nameConstraintsDN1CACert.crt
  restore_db

  VFY_ACTION="Valid DNS nameConstraints Test30"; log_banner
  certImport nameConstraintsDNS1CACert
  crlImport nameConstraintsDNS1CACRL.crl
  pkits $certs/ValidDNSnameConstraintsTest30EE.crt \
      $certs/nameConstraintsDNS1CACert.crt
  restore_db

  VFY_ACTION="Invalid DNS nameConstraints Test31"; log_banner
  certImport nameConstraintsDNS1CACert
  crlImport nameConstraintsDNS1CACRL.crl
  pkitsn $certs/InvalidDNSnameConstraintsTest31EE.crt \
      $certs/nameConstraintsDNS1CACert.crt
  restore_db

  VFY_ACTION="Valid DNS nameConstraints Test32"; log_banner
  certImport nameConstraintsDNS2CACert
  crlImport nameConstraintsDNS2CACRL.crl
  pkits $certs/ValidDNSnameConstraintsTest32EE.crt \
      $certs/nameConstraintsDNS2CACert.crt
  restore_db

  VFY_ACTION="Invalid DNS nameConstraints Test33"; log_banner
  certImport nameConstraintsDNS2CACert
  crlImport nameConstraintsDNS2CACRL.crl
  pkitsn $certs/InvalidDNSnameConstraintsTest33EE.crt \
      $certs/nameConstraintsDNS2CACert.crt
  restore_db

  VFY_ACTION="Valid URI nameConstraints Test34"; log_banner
  certImport nameConstraintsURI1CACert
  crlImport nameConstraintsURI1CACRL.crl
  pkits $certs/ValidURInameConstraintsTest34EE.crt \
      $certs/nameConstraintsURI1CACert.crt
  restore_db

  VFY_ACTION="Invalid URI nameConstraints Test35"; log_banner
  certImport nameConstraintsURI1CACert
  crlImport nameConstraintsURI1CACRL.crl
  pkitsn $certs/InvalidURInameConstraintsTest35EE.crt \
      $certs/nameConstraintsURI1CACert.crt
  restore_db

  VFY_ACTION="Valid URI nameConstraints Test36"; log_banner
  certImport nameConstraintsURI2CACert
  crlImport nameConstraintsURI2CACRL.crl
  pkits $certs/ValidURInameConstraintsTest36EE.crt \
      $certs/nameConstraintsURI2CACert.crt
  restore_db

  VFY_ACTION="Invalid URI nameConstraints Test37"; log_banner
  certImport nameConstraintsURI2CACert
  crlImport nameConstraintsURI2CACRL.crl
  pkitsn $certs/InvalidURInameConstraintsTest37EE.crt \
      $certs/nameConstraintsURI2CACert.crt
  restore_db

  VFY_ACTION="Invalid DNS nameConstraints Test38"; log_banner
  certImport nameConstraintsDNS1CACert
  crlImport nameConstraintsDNS1CACRL.crl
  pkitsn $certs/InvalidDNSnameConstraintsTest38EE.crt \
      $certs/nameConstraintsDNS1CACert.crt
  restore_db
}

pkits_PvtCertExtensions()
{
  break_table "NIST PKITS Section 4.16: Private Certificate Extensions"

  VFY_ACTION="Valid Unknown Not Critical Certificate Extension Test1"; log_banner
  pkits $certs/ValidUnknownNotCriticalCertificateExtensionTest1EE.crt

  VFY_ACTION="Invalid Unknown Critical Certificate Extension Test2"; log_banner
  pkitsn $certs/InvalidUnknownCriticalCertificateExtensionTest2EE.crt
}

############################## pkits_cleanup ###########################
# local shell function to finish this script (no exit since it might be 
# sourced)
########################################################################
pkits_cleanup()
{
  html "</TABLE><BR>"
  cd ${QADIR}
  . common/cleanup.sh
}


################################## main ################################
pkits_init 
pkits_SignatureVerification | tee -a $PKITS_LOG
pkits_ValidityPeriods | tee -a $PKITS_LOG
pkits_NameChaining | tee -a $PKITS_LOG
pkits_BasicCertRevocation | tee -a $PKITS_LOG
pkits_PathVerificWithSelfIssuedCerts | tee -a $PKITS_LOG
pkits_BasicConstraints | tee -a $PKITS_LOG
pkits_KeyUsage | tee -a $PKITS_LOG
if [ -n "$NSS_PKITS_POLICIES" ]; then
  pkits_CertificatePolicies | tee -a $PKITS_LOG
  pkits_RequireExplicitPolicy | tee -a $PKITS_LOG
  pkits_PolicyMappings | tee -a $PKITS_LOG
  pkits_InhibitPolicyMapping | tee -a $PKITS_LOG
  pkits_InhibitAnyPolicy | tee -a $PKITS_LOG
fi
pkits_NameConstraints | tee -a $PKITS_LOG
pkits_PvtCertExtensions | tee -a $PKITS_LOG
pkits_cleanup