summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/libpkix/include/pkix_pl_pki.h
blob: 0a449b94a7392e181a507cf4d14d356a1f1fbc3d (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
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
/* 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/. */
/*
 * This file defines several platform independent functions to
 * manipulate certificates and CRLs in a portable manner.
 *
 */

#ifndef _PKIX_PL_PKI_H
#define _PKIX_PL_PKI_H

#include "pkixt.h"
#include "seccomon.h"
#include "certt.h"

#ifdef __cplusplus
extern "C" {
#endif

/* General
 *
 * Please refer to the libpkix Programmer's Guide for detailed information
 * about how to use the libpkix library. Certain key warnings and notices from
 * that document are repeated here for emphasis.
 *
 * All identifiers in this file (and all public identifiers defined in
 * libpkix) begin with "PKIX_". Private identifiers only intended for use
 * within the library begin with "pkix_".
 *
 * A function returns NULL upon success, and a PKIX_Error pointer upon failure.
 *
 * Unless otherwise noted, for all accessor (gettor) functions that return a
 * PKIX_PL_Object pointer, callers should assume that this pointer refers to a
 * shared object. Therefore, the caller should treat this shared object as
 * read-only and should not modify this shared object. When done using the
 * shared object, the caller should release the reference to the object by
 * using the PKIX_PL_Object_DecRef function.
 *
 * While a function is executing, if its arguments (or anything referred to by
 * its arguments) are modified, free'd, or destroyed, the function's behavior
 * is undefined.
 *
 */

/*
 * Cert
 *
 * A Cert represents an X.509 certificate. It can be created using the bytes
 * of a valid ASN.1 DER encoding. Once created, a Cert is immutable. The
 * following functions include accessors (gettors) for the various components
 * of an X.509 certificate. Also included are functions to perform various
 * checks on a certificate, including name constraints, key usage, validity
 * (expiration), and signature verification.
 */

/*
 * FUNCTION: PKIX_PL_Cert_Create
 * DESCRIPTION:
 *
 *  Creates a new certificate using the bytes in the ByteArray pointed to by
 *  "byteArray" and stores it at "pCert". If the bytes are not a valid ASN.1
 *  DER encoding of a certificate, a PKIX_Error pointer is returned. Once
 *  created, a Cert is immutable.
 *
 *  Certificate  ::=  SEQUENCE  {
 *      tbsCertificate          TBSCertificate,
 *      signatureAlgorithm      AlgorithmIdentifier,
 *      signatureValue          BIT STRING  }
 *
 *  AlgorithmIdentifier  ::=  SEQUENCE  {
 *      algorithm               OBJECT IDENTIFIER,
 *      parameters              ANY DEFINED BY algorithm OPTIONAL  }
 *
 *  TBSCertificate  ::=  SEQUENCE  {
 *      version         [0]  EXPLICIT Version DEFAULT v1,
 *      serialNumber    CertificateSerialNumber,
 *      signature       AlgorithmIdentifier,
 *      issuer          Name,
 *      validity        Validity,
 *      subject         Name,
 *      subjectPublicKeyInfo SubjectPublicKeyInfo,
 *      issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,
 *                          -- If present, version MUST be v2 or v3
 *      subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,
 *                              -- If present, version MUST be v2 or v3
 *      extensions      [3]  EXPLICIT Extensions OPTIONAL
 *                              -- If present, version MUST be v3
 *      }
 *
 *  Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
 *
 *  CertificateSerialNumber  ::=  INTEGER
 *
 *  Validity ::= SEQUENCE {
 *      notBefore       Time,
 *      notAfter        Time }
 *
 *  Time ::= CHOICE {
 *      utcTime         UTCTime,
 *      generalTime     GeneralizedTime }
 *
 *  UniqueIdentifier  ::=  BIT STRING
 *
 *  SubjectPublicKeyInfo  ::=  SEQUENCE  {
 *      algorithm               AlgorithmIdentifier,
 *      subjectPublicKey        BIT STRING  }
 *
 *  Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension
 *
 *  Extension  ::=  SEQUENCE  {
 *      extnID          OBJECT IDENTIFIER,
 *      critical        BOOLEAN DEFAULT FALSE,
 *      extnValue       OCTET STRING  }
 *
 * PARAMETERS:
 *  "byteArray"
 *      Address of ByteArray representing the CERT's DER encoding.
 *      Must be non-NULL.
 *  "pCert"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_Create(
        PKIX_PL_ByteArray *byteArray,
        PKIX_PL_Cert **pCert,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_CreateFromCERTCertificate
 * DESCRIPTION:
 *
 * Creates a new certificate using passed in CERTCertificate object.
 *
 * PARAMETERS:
 *  "nssCert"
 *      The object that will be used to create new PKIX_PL_Cert.
 *  "pCert"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_CreateFromCERTCertificate(
        const CERTCertificate *nssCert,
        PKIX_PL_Cert **pCert,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetCERTCertificate
 * DESCRIPTION:
 *
 * Returns underlying CERTCertificate structure. Return CERTCertificate
 * object is duplicated and should be destroyed by caller.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of PKIX_PL_Cert. Must be non-NULL.
 *  "pCert"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetCERTCertificate(
        PKIX_PL_Cert *cert,
        CERTCertificate **pnssCert, 
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetVersion
 * DESCRIPTION:
 *
 *  Retrieves the version of the Cert pointed to by "cert" and stores it at
 *  "pVersion". The version number will either be 0, 1, or 2 (corresponding to
 *  v1, v2, or v3, respectively).
 *
 *  Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose version is to be stored. Must be non-NULL.
 *  "pVersion"
 *      Address where PKIX_UInt32 will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetVersion(
        PKIX_PL_Cert *cert,
        PKIX_UInt32 *pVersion,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSerialNumber
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the BigInt that represents the serial number of the
 *  Cert pointed to by "cert" and stores it at "pSerialNumber".
 *
 *  CertificateSerialNumber  ::=  INTEGER
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose serial number is to be stored. Must be non-NULL.
 *  "pSerial"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSerialNumber(
        PKIX_PL_Cert *cert,
        PKIX_PL_BigInt **pSerial,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetIssuer
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the X500Name that represents the issuer DN of the
 *  Cert pointed to by "cert" and stores it at "pIssuer".
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose issuer is to be stored. Must be non-NULL.
 *  "pIssuer"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetIssuer(
        PKIX_PL_Cert *cert,
        PKIX_PL_X500Name **pIssuer,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSubject
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the X500Name that represents the subject DN of the
 *  Cert pointed to by "cert" and stores it at "pSubject". If the Cert does not
 *  have a subject DN, this function stores NULL at "pSubject".
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject is to be stored. Must be non-NULL.
 *  "pSubject"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubject(
        PKIX_PL_Cert *cert,
        PKIX_PL_X500Name **pSubject,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSubjectPublicKeyAlgId
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the OID that represents the subject public key
 *  algorithm of the Cert pointed to by "cert" and stores it at
 *  "pSubjKeyAlgId".
 *
 *  SubjectPublicKeyInfo  ::=  SEQUENCE  {
 *      algorithm               AlgorithmIdentifier,
 *      subjectPublicKey        BIT STRING  }
 *
 *  AlgorithmIdentifier  ::=  SEQUENCE  {
 *      algorithm               OBJECT IDENTIFIER,
 *      parameters              ANY DEFINED BY algorithm OPTIONAL  }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject public key algorithm OID is to be stored.
 *      Must be non-NULL.
 *  "pSubjKeyAlgId"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubjectPublicKeyAlgId(
        PKIX_PL_Cert *cert,
        PKIX_PL_OID **pSubjKeyAlgId,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSubjectPublicKey
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the PublicKey that represents the subject public key
 *  of the Cert pointed to by "cert" and stores it at "pPublicKey".
 *
 *  SubjectPublicKeyInfo  ::=  SEQUENCE  {
 *      algorithm               AlgorithmIdentifier,
 *      subjectPublicKey        BIT STRING  }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject public key is to be stored.
 *      Must be non-NULL.
 *  "pPublicKey"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubjectPublicKey(
        PKIX_PL_Cert *cert,
        PKIX_PL_PublicKey **pPublicKey,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_PublicKey_NeedsDSAParameters
 * DESCRIPTION:
 *
 * Determines if the PublicKey pointed to by "pubKey" is a DSA Key with null
 * parameters and stores the result at "pNeedsParams". 
 *
 * PARAMETERS:
 *  "pubKey"
 *      Address of the Public Key of interest. Must be non-NULL.
 *  "pNeedsParams"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a PublicKey Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_PublicKey_NeedsDSAParameters(
        PKIX_PL_PublicKey *pubKey,
        PKIX_Boolean *pNeedsParams,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_PublicKey_MakeInheritedDSAPublicKey
 * DESCRIPTION:
 *
 * This function is used for DSA key parameter inheritance, which allows a
 * first DSA key with omitted parameters (pointed to by "firstKey") to inherit
 * the PQG parameters of a second DSA key that does have parameters. (pointed
 * to by "secondKey"). Once created, a PublicKey is immutable.
 *
 * Specifically, the algorithm used by the function is:
 *
 * If the first PublicKey is not a DSA public key with omitted parameters,
 *      the function stores NULL at "pResultKey". (No Error is returned)
 * Else if the second PublicKey is not a DSA public key with non-NULL,
 *      parameters, the function returns an Error.
 * Else
 *      the function creates a third PublicKey with a "Y" value from the
 *      first PublicKey and the DSA parameters from the second PublicKey,
 *      and stores it at "pResultKey".
 *
 * PARAMETERS:
 *  "firstKey"
 *      Address of a Public Key that needs to inherit DSA parameters.
 *      Must be non-NULL.
 *  "secondKey"
 *      Address of a Public Key that has DSA parameters that will be inherited
 *      by "firstKey". Must be non-NULL.
 *  "pResultKey"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a PublicKey Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_PublicKey_MakeInheritedDSAPublicKey(
        PKIX_PL_PublicKey *firstKey,
        PKIX_PL_PublicKey *secondKey,
        PKIX_PL_PublicKey **pResultKey,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetCriticalExtensionOIDs
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of OIDs (each OID corresponding to a
 *  critical extension of the Cert pointed to by "cert") and stores it at
 *  "pExtensions". If "cert" does not have any critical extensions, this
 *  function stores an empty List at "pExtensions".
 *
 *  Note that the List returned by this function is immutable.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose critical extension OIDs are to be stored.
 *      Must be non-NULL.
 *  "pExtensions"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetCriticalExtensionOIDs(
        PKIX_PL_Cert *cert,
        PKIX_List **pExtensions,  /* list of PKIX_PL_OID */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetAuthorityKeyIdentifier
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a ByteArray representing the authority key
 *  identifier extension of the Cert pointed to by "cert" and stores it at
 *  "pAuthKeyId".
 *
 *  Note that this function only retrieves the keyIdentifier component
 *  (OCTET STRING) of the AuthorityKeyIdentifier extension, when present.
 *
 *  If "cert" does not have an AuthorityKeyIdentifier extension or if the
 *  keyIdentifier component of the AuthorityKeyIdentifier extension is not
 *  present, this function stores NULL at "pAuthKeyId".
 *
 *  AuthorityKeyIdentifier ::= SEQUENCE {
 *      keyIdentifier                   [0] KeyIdentifier           OPTIONAL,
 *      authorityCertIssuer             [1] GeneralNames            OPTIONAL,
 *      authorityCertSerialNumber       [2] CertificateSerialNumber OPTIONAL  }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose authority key identifier is to be stored.
 *      Must be non-NULL.
 *  "pAuthKeyId"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetAuthorityKeyIdentifier(
        PKIX_PL_Cert *cert,
        PKIX_PL_ByteArray **pAuthKeyId,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSubjectKeyIdentifier
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a ByteArray representing the subject key identifier
 *  extension of the Cert pointed to by "cert" and stores it at "pSubjKeyId".
 *  If "cert" does not have a SubjectKeyIdentifier extension, this function
 *  stores NULL at "pSubjKeyId".
 *
 *  SubjectKeyIdentifier ::= KeyIdentifier
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject key identifier is to be stored.
 *      Must be non-NULL.
 *  "pSubjKeyId"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubjectKeyIdentifier(
        PKIX_PL_Cert *cert,
        PKIX_PL_ByteArray **pSubjKeyId,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetSubjectAltNames
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of GeneralNames (each GeneralName
 *  representing a subject alternative name found in the subject alternative
 *  names extension of the Cert pointed to by "cert") and stores it at
 *  "pSubjectAltNames". If "cert" does not have a SubjectAlternativeNames
 *  extension, this function stores NULL at "pSubjectAltNames".
 *
 *  Note that the List returned by this function is immutable.
 *
 *  SubjectAltName ::= GeneralNames
 *
 *  GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName
 *
 *  GeneralName ::= CHOICE {
 *      otherName                       [0]     OtherName,
 *      rfc822Name                      [1]     IA5String,
 *      dNSName                         [2]     IA5String,
 *      x400Address                     [3]     ORAddress,
 *      directoryName                   [4]     Name,
 *      ediPartyName                    [5]     EDIPartyName,
 *      uniformResourceIdentifier       [6]     IA5String,
 *      iPAddress                       [7]     OCTET STRING,
 *      registeredID                    [8]     OBJECT IDENTIFIER }
 *
 *  OtherName ::= SEQUENCE {
 *      type-id                         OBJECT IDENTIFIER,
 *      value                           [0] EXPLICIT ANY DEFINED BY type-id }
 *
 *  EDIPartyName ::= SEQUENCE {
 *      nameAssigner                    [0]     DirectoryString OPTIONAL,
 *      partyName                       [1]     DirectoryString }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subjectAltNames are to be stored.
 *      Must be non-NULL.
 *  "pSubjectAltNames"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubjectAltNames(
        PKIX_PL_Cert *cert,
        PKIX_List **pSubjectAltNames,  /* list of PKIX_PL_GeneralName */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetAllSubjectNames
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of GeneralNames (each GeneralName
 *  representing a subject DN or a subject alternative name found in the
 *  subject alternative names extension of the Cert pointed to by "cert") and
 *  stores it at "pAllSubjectNames".If the Subject DN of "cert" is empty and
 *  it does not have a SubjectAlternativeNames extension, this function stores
 *  NULL at "pAllSubjectNames".
 *
 *  Note that the List returned by this function is immutable.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject DN and subjectAltNames are to be stored.
 *      Must be non-NULL.
 *  "pAllSubjectNames"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetAllSubjectNames(
        PKIX_PL_Cert *cert,
        PKIX_List **pAllSubjectNames,  /* list of PKIX_PL_GeneralName */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetExtendedKeyUsage
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a List of OIDs (each OID corresponding to an
 *  extended key usage of the Cert pointed to by "cert") and stores it at
 *  "pKeyUsage". If "cert" does not have an extended key usage extension, this
 *  function stores a NULL at "pKeyUsage".
 *
 *  Note that the List returned by this function is immutable.
 *
 *  ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId
 *
 *  KeyPurposeId ::= OBJECT IDENTIFIER
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose extended key usage OIDs are to be stored.
 *      Must be non-NULL.
 *  "pKeyUsage"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetExtendedKeyUsage(
        PKIX_PL_Cert *cert,
        PKIX_List **pKeyUsage,  /* list of PKIX_PL_OID */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetNameConstraints
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a CertNameConstraints object representing the name
 *  constraints extension of the Cert pointed to by "cert" and stores it at
 *  "pNameConstraints".
 *
 *  If "cert" does not have a name constraints extension, this function stores
 *  NULL at "pNameConstraints".
 *
 *  NameConstraints ::= SEQUENCE {
 *      permittedSubtrees       [0]     GeneralSubtrees OPTIONAL,
 *      excludedSubtrees        [1]     GeneralSubtrees OPTIONAL }
 *
 *  GeneralSubtrees ::= SEQUENCE SIZE (1..MAX) OF GeneralSubtree
 *
 *  GeneralSubtree ::= SEQUENCE {
 *      base                    GeneralName,
 *      minimum         [0]     BaseDistance DEFAULT 0,
 *      maximum         [1]     BaseDistance OPTIONAL }
 *
 *  BaseDistance ::= INTEGER (0..MAX)
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose name constraints extension is to be stored.
 *      Must be non-NULL.
 *  "pNameConstraints"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetNameConstraints(
        PKIX_PL_Cert *cert,
        PKIX_PL_CertNameConstraints **pNameConstraints,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetBasicConstraints
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a CertBasicConstraints object representing the basic
 *  constraints extension of the Cert pointed to by "cert" and stores it at
 *  "pBasicConstraints".
 *
 *  If "cert" does not have a basic constraints extension, this function stores
 *  NULL at "pBasicConstraints". Once created, a CertBasicConstraints object
 *  is immutable.
 *
 *  BasicConstraints ::= SEQUENCE {
 *      cA                      BOOLEAN DEFAULT FALSE,
 *      pathLenConstraint       INTEGER (0..MAX) OPTIONAL }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose basic constraints extension is to be stored.
 *      Must be non-NULL.
 *  "pBasicConstraints"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetBasicConstraints(
        PKIX_PL_Cert *cert,
        PKIX_PL_CertBasicConstraints **pBasicConstraints,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_BasicConstraints_GetCAFlag
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a Boolean value representing the cA Flag component
 *  of the CertBasicConstraints object pointed to by "basicConstraints" and
 *  stores it at "pResult".
 *
 *  BasicConstraints ::= SEQUENCE {
 *      cA                      BOOLEAN DEFAULT FALSE,
 *      pathLenConstraint       INTEGER (0..MAX) OPTIONAL }
 *
 * PARAMETERS:
 *  "basicConstraints"
 *      Address of CertBasicConstraints whose cA Flag is to be stored.
 *      Must be non-NULL.
 *  "pResult"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_BasicConstraints_GetCAFlag(
        PKIX_PL_CertBasicConstraints *basicConstraints,
        PKIX_Boolean *pResult,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_BasicConstraints_GetPathLenConstraint
 * DESCRIPTION:
 *
 *  Retrieves a pointer to an integer value representing the pathLenConstraint
 *  component of the CertBasicConstraints object pointed to by
 *  "basicConstraints" and stores it at "pPathLenConstraint". If the
 *  pathLenConstraint component is not present, this function stores -1 at
 *  "pPathLenConstraint".
 *
 * PARAMETERS:
 *  "basicConstraints"
 *      Address of CertBasicConstraints whose pathLen is to be stored.
 *      Must be non-NULL.
 *  "pPathLenConstraint"
 *      Address where PKIX_Int32 will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_BasicConstraints_GetPathLenConstraint(
        PKIX_PL_CertBasicConstraints *basicConstraints,
        PKIX_Int32 *pPathLenConstraint,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetPolicyInformation
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a List of CertPolicyInfos found in the certificate
 *  policies extension of the Cert pointed to by "cert" and stores it at
 *  "pPolicyInfo". If "cert" does not have a certificate policies extension,
 *  this function stores NULL at "pPolicyInfo". Once created, a CertPolicyInfo
 *  object is immutable.
 *
 *  Note that the List returned by this function is immutable.
 *
 *  certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
 *
 *  PolicyInformation ::= SEQUENCE {
 *      policyIdentifier   CertPolicyId,
 *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
 *                              PolicyQualifierInfo OPTIONAL }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose CertPolicyInfos are to be stored.
 *      Must be non-NULL.
 *  "pPolicyInfo"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetPolicyInformation(
        PKIX_PL_Cert *cert,
        PKIX_List **pPolicyInfo, /* list of PKIX_PL_CertPolicyInfo */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CertPolicyInfo_GetPolicyId
 * DESCRIPTION:
 *
 *  Retrieves a pointer to an OID representing the policyIdentifier of the
 *  CertPolicyInfo pointed to by "policyInfo" and stores it at "pCertPolicyId".
 *
 *  certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
 *
 *  PolicyInformation ::= SEQUENCE {
 *      policyIdentifier   CertPolicyId,
 *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
 *                              PolicyQualifierInfo OPTIONAL }
 *
 *  CertPolicyId ::= OBJECT IDENTIFIER
 *
 * PARAMETERS:
 *  "policyInfo"
 *      Address of CertPolicyInfo whose policy identifier is to be stored.
 *      Must be non-NULL.
 *  "pCertPolicyId"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CertPolicyInfo_GetPolicyId(
        PKIX_PL_CertPolicyInfo *policyInfo,
        PKIX_PL_OID **pCertPolicyId,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CertPolicyInfo_GetPolQualifiers
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a List of the CertPolicyQualifiers representing
 *  the policyQualifiers of the CertPolicyInfo pointed to by "policyInfo" and
 *  stores it at "pPolicyQualifiers". If "policyInfo" does not have any
 *  policyQualifiers, this function stores NULL at "pPolicyQualifiers". Once
 *  created, a CertPolicyQualifier is immutable.
 *
 *  Note that the List returned by this function is immutable.
 *
 *  certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
 *
 *  PolicyInformation ::= SEQUENCE {
 *      policyIdentifier   CertPolicyId,
 *      policyQualifiers   SEQUENCE SIZE (1..MAX) OF
 *                              PolicyQualifierInfo OPTIONAL }
 *
 *  PolicyQualifierInfo ::= SEQUENCE {
 *      policyQualifierId  PolicyQualifierId,
 *      qualifier       ANY DEFINED BY policyQualifierId }
 *
 * PARAMETERS:
 *  "policyInfo"
 *      Address of CertPolicyInfo whose policy qualifiers List is to be stored.
 *      Must be non-NULL.
 *  "pPolicyQualifiers"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CertPolicyInfo_GetPolQualifiers(
        PKIX_PL_CertPolicyInfo *policyInfo,
        PKIX_List **pPolicyQualifiers, /* list of PKIX_PL_CertPolicyQualifier */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_PolicyQualifier_GetPolicyQualifierId
 * DESCRIPTION:
 *
 *  Retrieves a pointer to an OID representing the policyQualifierId of the
 *  CertPolicyQualifier pointed to by "policyQualifier" and stores it at
 *  "pPolicyQualifierId".
 *
 *  PolicyQualifierInfo ::= SEQUENCE {
 *      policyQualifierId       PolicyQualifierId,
 *      qualifier               ANY DEFINED BY policyQualifierId }
 *
 *  PolicyQualifierId ::=
 *      OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
 *
 * PARAMETERS:
 *  "policyQualifier"
 *      Address of CertPolQualifier whose policyQualifierId is to be stored.
 *      Must be non-NULL.
 *  "pPolicyQualifierId"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_PolicyQualifier_GetPolicyQualifierId(
        PKIX_PL_CertPolicyQualifier *policyQualifier,
        PKIX_PL_OID **pPolicyQualifierId,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_PolicyQualifier_GetQualifier
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a ByteArray representing the qualifier of the
 *  CertPolicyQualifier pointed to by "policyQualifier" and stores it at
 *  "pQualifier".
 *
 *  PolicyQualifierInfo ::= SEQUENCE {
 *      policyQualifierId       PolicyQualifierId,
 *      qualifier               ANY DEFINED BY policyQualifierId }
 *
 * PARAMETERS:
 *  "policyQualifier"
 *      Address of CertPolicyQualifier whose qualifier is to be stored.
 *      Must be non-NULL.
 *  "pQualifier"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_PolicyQualifier_GetQualifier(
        PKIX_PL_CertPolicyQualifier *policyQualifier,
        PKIX_PL_ByteArray **pQualifier,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetPolicyMappings
 * DESCRIPTION:
 *
 *  Retrieves a pointer to a List of CertPolicyMaps found in the policy
 *  mappings extension of the Cert pointed to by "cert" and stores it at
 *  "pPolicyMappings". If "cert" does not have a policy mappings extension,
 *  this function stores NULL at "pPolicyMappings". Once created, a
 *  CertPolicyMap is immutable.
 *
 *  Note that the List returned by this function is immutable.
 *
 *  PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
 *      issuerDomainPolicy      CertPolicyId,
 *      subjectDomainPolicy     CertPolicyId }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose CertPolicyMaps are to be stored.
 *      Must be non-NULL.
 *  "pPolicyMappings"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetPolicyMappings(
        PKIX_PL_Cert *cert,
        PKIX_List **pPolicyMappings, /* list of PKIX_PL_CertPolicyMap */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CertPolicyMap_GetIssuerDomainPolicy
 * DESCRIPTION:
 *
 *  Retrieves a pointer to an OID representing the issuerDomainPolicy of the
 *  CertPolicyMap pointed to by "policyMapping" and stores it at
 *  "pIssuerDomainPolicy".
 *
 *  PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
 *      issuerDomainPolicy      CertPolicyId,
 *      subjectDomainPolicy     CertPolicyId }
 *
 * PARAMETERS:
 *  "policyMapping"
 *      Address of CertPolicyMap whose issuerDomainPolicy is to be stored.
 *      Must be non-NULL.
 *  "pIssuerDomainPolicy"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CertPolicyMap_GetIssuerDomainPolicy(
        PKIX_PL_CertPolicyMap *policyMapping,
        PKIX_PL_OID **pIssuerDomainPolicy,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CertPolicyMap_GetSubjectDomainPolicy
 * DESCRIPTION:
 *
 *  Retrieves a pointer to an OID representing the subjectDomainPolicy of the
 *  CertPolicyMap pointed to by "policyMapping" and stores it at
 *  "pSubjectDomainPolicy".
 *
 *  PolicyMappings ::= SEQUENCE SIZE (1..MAX) OF SEQUENCE {
 *      issuerDomainPolicy      CertPolicyId,
 *      subjectDomainPolicy     CertPolicyId }
 *
 * PARAMETERS:
 *  "policyMapping"
 *      Address of CertPolicyMap whose subjectDomainPolicy is to be stored.
 *      Must be non-NULL.
 *  "pSubjectDomainPolicy"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CertPolicyMap_GetSubjectDomainPolicy(
        PKIX_PL_CertPolicyMap *policyMapping,
        PKIX_PL_OID **pSubjectDomainPolicy,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetRequireExplicitPolicy
 * DESCRIPTION:
 *
 *  Retrieves the requireExplicitPolicy value of the policy constraints
 *  extension of the Cert pointed to by "cert" and stores it at "pSkipCerts".
 *  If "cert" does not have a policy constraints extension or the
 *  requireExplicitPolicy component is not populated, this function stores -1
 *  at "pSkipCerts".
 *
 *  PolicyConstraints ::= SEQUENCE {
 *      requireExplicitPolicy   [0] SkipCerts OPTIONAL,
 *      inhibitPolicyMapping    [1] SkipCerts OPTIONAL }
 *
 *  SkipCerts ::= INTEGER (0..MAX)
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose requireExplicitPolicy value is to be stored.
 *      Must be non-NULL.
 *  "pSkipCerts"
 *      Address where PKIX_Int32 will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetRequireExplicitPolicy(
        PKIX_PL_Cert *cert,
        PKIX_Int32 *pSkipCerts,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetPolicyMappingInhibited
 * DESCRIPTION:
 *
 *  Retrieves the inhibitPolicyMapping value of the policy constraints
 *  extension of the Cert pointed to by "cert" and stores it at "pSkipCerts".
 *  If "cert" does not have a policy constraints extension or the
 *  inhibitPolicyMapping component is not populated, this function stores -1
 *  at "pSkipCerts".
 *
 *  PolicyConstraints ::= SEQUENCE {
 *      requireExplicitPolicy   [0] SkipCerts OPTIONAL,
 *      inhibitPolicyMapping    [1] SkipCerts OPTIONAL }
 *
 *  SkipCerts ::= INTEGER (0..MAX)
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose requireExplicitPolicy value is to be stored.
 *      Must be non-NULL.
 *  "pSkipCerts"
 *      Address where PKIX_Int32 will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetPolicyMappingInhibited(
        PKIX_PL_Cert *cert,
        PKIX_Int32 *pSkipCerts,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetInhibitAnyPolicy
 * DESCRIPTION:
 *
 *  Retrieves the value of the inhibit any-policy extension of the Cert
 *  pointed to by "cert" and stores it at "pSkipCerts". If "cert" does not have
 *  an inhibit any-policy extension, this function stores -1 at "pSkipCerts".
 *
 *  InhibitAnyPolicy ::= SkipCerts
 *
 *  SkipCerts ::= INTEGER (0..MAX)
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose inhibit any-policy extensions value is to be
 *      stored. Must be non-NULL.
 *  "pSkipCerts"
 *      Address where PKIX_Int32 will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetInhibitAnyPolicy(
        PKIX_PL_Cert *cert,
        PKIX_Int32 *pSkipCerts,
        void *plContext);

/* policy processing functions */

/*
 * FUNCTION: PKIX_PL_Cert_AreCertPoliciesCritical
 * DESCRIPTION:
 *
 *  Checks whether the certificate policies extension of the Cert pointed to
 *  by "cert" is critical and stores the Boolean result at "pCritical". If
 *  "cert" does not have a certificate policies extension, this function
 *  stores NULL at "pCritical".
 *
 *  XXX what distinguishes NULL from PKIX_FALSE?
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose certificate policies extension's criticality is
 *      to be determined. Must be non-NULL.
 *  "pCritical"
 *      Address where PKIX_Boolean will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_AreCertPoliciesCritical(
        PKIX_PL_Cert *cert,
        PKIX_Boolean *pCritical,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_CheckNameConstraints
 * DESCRIPTION:
 *
 *  Checks whether the subject distinguished name and subject alternative names
 *  of the Cert pointed to by "cert" satisfy the CertNameConstraints pointed
 *  to by "nameConstraints". If the CertNameConstraints are not satisfied, a
 *  PKIX_Error pointer is returned. If "nameConstraints" is NULL, the function
 *  does nothing.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose subject names are to be checked.
 *      Must be non-NULL.
 *  "nameConstraints"
 *      Address of CertNameConstraints that need to be satisfied.
 *  "treatCommonNameAsDNSName"
 *      PKIX_TRUE if the subject common name should be considered a dNSName
 *      when evaluating name constraints.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_CheckNameConstraints(
        PKIX_PL_Cert *cert,
        PKIX_PL_CertNameConstraints *nameConstraints,
        PKIX_Boolean treatCommonNameAsDNSName,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_MergeNameConstraints
 * DESCRIPTION:
 *
 *  Merges the CertNameConstraints pointed to by "firstNC" and the
 *  CertNameConstraints pointed to by "secondNC" and stores the merged
 *  CertNameConstraints at "pResultNC". If "secondNC" is NULL, the
 *  CertNameConstraints pointed to by "firstNC" is stored at "pResultNC".
 *
 *  Once created, a CertNameConstraints object is immutable.
 *
 * PARAMETERS:
 *  "firstNC"
 *      Address of first CertNameConstraints to be merged. Must be non-NULL.
 *  "secondNC"
 *      Address of second CertNameConstraints to be merged
 *  "pResultNC"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_MergeNameConstraints(
        PKIX_PL_CertNameConstraints *firstNC,
        PKIX_PL_CertNameConstraints *secondNC,
        PKIX_PL_CertNameConstraints **pResultNC,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_VerifyKeyUsage
 * DESCRIPTION:
 *
 *  Verifies that the keyUsage bit(s) specified by "keyUsage" appear in the
 *  keyUsage extension of the Cert pointed to by "cert". The keyUsage bit
 *  values specified in pkixt.h are supported, and can be bitwise or'ed if
 *  multiple bit values are to be verified. If the keyUsages do not all appear
 *  in the keyUsage extension of "cert", a PKIX_Error pointer is returned.
 *
 *  KeyUsage ::= BIT STRING {
 *      digitalSignature        (0),
 *      nonRepudiation          (1),
 *      keyEncipherment         (2),
 *      dataEncipherment        (3),
 *      keyAgreement            (4),
 *      keyCertSign             (5),
 *      cRLSign                 (6),
 *      encipherOnly            (7),
 *      decipherOnly            (8) }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose keyUsage bits are to be verified.
 *      Must be non-NULL.
 *  "keyUsage"
 *      Constant representing keyUsage bit(s) that all must appear in keyUsage
 *      extension of "cert".
 *  "plContext" - Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_VerifyKeyUsage(
        PKIX_PL_Cert *cert,
        PKIX_UInt32 keyUsage,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_VerifyCertAndKeyType
 * DESCRIPTION:
 *
 * Verifies cert and key types against certificate usage that is
 * a part of plContext(pkix_pl_nsscontext) structure. Throws an error
 * if cert or key types does not match.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose keyUsage bits are to be verified.
 *      Must be non-NULL.
 *  "isLeafCert"
 *      What type of a cert has been verified.
 *  "plContext" - Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_VerifyCertAndKeyType(
        PKIX_PL_Cert *cert,
        PKIX_Boolean isChainCert,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_CheckValidity
 * DESCRIPTION:
 *
 *  Checks whether the Cert pointed to by "cert" would be valid at the time
 *  represented by the Date pointed to by "date". If "date" is NULL, then this
 *  function checks whether the Cert would be valid at the current time. If the
 *  Cert would not be valid at the specified Date, a PKIX_Error pointer is
 *  returned.
 *
 *  Validity ::= SEQUENCE {
 *      notBefore       Time,
 *      notAfter        Time }
 *
 *  Time ::= CHOICE {
 *      utcTime         UTCTime,
 *      generalTime     GeneralizedTime }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose validity is to be checked. Must be non-NULL.
 *  "date"
 *      Address of Date at which the Cert is being checked for validity.
 *      If NULL, the current time is used for the Date.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_CheckValidity(
        PKIX_PL_Cert *cert,
        PKIX_PL_Date *date,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetValidityNotAfter
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the Date that represents the notAfter time of the
 *  Certificate pointed to by "cert" and stores it at "pDate".
 *
 *  Validity ::= SEQUENCE {
 *      notBefore       Time,
 *      notAfter        Time }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose validity time is to be retrieved. Must be
 *      non-NULL.
 *  "date"
 *      Address of Date at which the Cert's notAfter time is being retrieved.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetValidityNotAfter(
        PKIX_PL_Cert *cert,
        PKIX_PL_Date **pDate,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_VerifySignature
 * DESCRIPTION:
 *
 *  Verifies the signature on the Cert pointed to by "cert" using the
 *  PublicKey pointed to by "pubKey". If the signature doesn't verify, an
 *  Error pointer is returned.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose signature is to be verified. Must be non-NULL.
 *  "pubKey"
 *      Address of a Public Key used to verify the signature. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_VerifySignature(
        PKIX_PL_Cert *cert,
        PKIX_PL_PublicKey *pubKey,
        void *plContext);

/* A set of flags to indicate how explicitly configured trust anchors should be
 * handled by PKIX_PL_Cert_IsCertTrusted
 */
typedef enum PKIX_PL_TrustAnchorModeEnum {
        /* Indicates trust anchors should be ignored; only the underlying
         * platform's trust settings should be used.
         */
        PKIX_PL_TrustAnchorMode_Ignore,

        /* Indicates that explicitly configured trust anchors may be considered
         * trustworthy, if present.
         * Note: If the underlying platform supports marking a certificate as
         *       explicitly untrustworthy, explicitly configured trust anchors
         *       MAY be ignored/rejected.
         */
        PKIX_PL_TrustAnchorMode_Additive,

        /* Indicates that ONLY trust anchors should be considered as
         * trustworthy.
         * Note: If the underlying platform supports marking a certificate as
         *       explicitly untrustworthy, explicitly configured trust anchors
         *       MAY be ignored/rejected.
         */
        PKIX_PL_TrustAnchorMode_Exclusive
} PKIX_PL_TrustAnchorMode;

/*
 * FUNCTION: PKIX_PL_Cert_IsCertTrusted
 * DESCRIPTION:
 *
 *  Checks the Cert specified by "cert" to determine, in a manner that depends
 *  on the underlying platform, whether it is trusted, and stores the result in
 *  "pTrusted". If a certificate is trusted it means that a chain built to that
 *  certificate, and satisfying all the usage, policy, validity, and other
 *  tests, is a valid chain and the End Entity certificate from which it was
 *  built can be trusted.
 *
 *  If the Certificate is not intrinsically trustworthy, it still might end up a
 *  component in a successful chain.
 *
 *  If the Certificate is intrinsically untrustworthy, this function will return
 *  an error. 
 *
 * PARAMETERS
 *  "cert"
 *      Address of Cert whose trustworthiness is to be determined. Must be
 *      non-NULL.
 *  "trustAnchorMode"
 *      A PKIX_PL_TrustAnchorMode that indicates how explicitly defined user
 *      trust anchors should be handled.
 *  "pTrusted"
 *      Address where the Boolean value will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CERT Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_IsCertTrusted(
        PKIX_PL_Cert *cert,
        PKIX_PL_TrustAnchorMode trustAnchorMode,
        PKIX_Boolean *pTrusted,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_IsLeafCertTrusted
 * DESCRIPTION:
 *
 *  Checks the Leaf Cert specified by "cert" to determine, in a manner that 
 *  depends on the underlying platform, whether it is trusted, and stores the 
 *  result in "pTrusted". If a certificate is trusted it means that this
 *  End Entify certificate has been marked as trusted for the requested usage,
 *  policy, validity, and other tests.
 *
 *  If the Certificate is not intrinsically trustworthy, we can still try to 
 *  build a successful chain.
 *
 *  If the Certificate is intrinsically untrustworthy, this function will return
 *  an error. 
 *
 * PARAMETERS
 *  "cert"
 *      Address of Cert whose trustworthiness is to be determined. Must be
 *      non-NULL.
 *  "pTrusted"
 *      Address where the Boolean value will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CERT Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_IsLeafCertTrusted(
        PKIX_PL_Cert *cert,
        PKIX_Boolean *pTrusted,
        void *plContext);

/* FUNCTION: PKIX_PL_Cert_SetAsTrustAnchor */
PKIX_Error*
PKIX_PL_Cert_SetAsTrustAnchor(PKIX_PL_Cert *cert, 
                              void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetCacheFlag
 * DESCRIPTION:
 *
 *  Retrieves the value of the cache flag in "cert" and return it at address
 *  pointed by "pCacheFlag". The initila cache flag is determined by the
 *  CertStore this "cert" is fetched from. When CertStore is created, user
 *  need to specify if the data should be cached.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose cache flag is fetched. Must be non-NULL.
 *  "pCacheFlag"
 *      Address where PKIX_Boolean will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetCacheFlag(
        PKIX_PL_Cert *cert,
        PKIX_Boolean *pCacheFlag,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_SetCacheFlag
 * DESCRIPTION:
 *
 *  Set the value of the cache flag in "cert" base on the boolean value stored
 *  at "cacheFlag". This function is meant to be used by CertStore after a
 *  Cert is created.
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert where "cacheFlag" is stored. Must be non-NULL.
 *  "cacheFlag"
 *      PKIX_Boolean flag for cache flag.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_SetCacheFlag(
        PKIX_PL_Cert *cert,
        PKIX_Boolean cacheFlag,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_GetTrustCertStore
 * DESCRIPTION:
 *
 *  Retrieves the value of the CertStore in "cert" and return it at address
 *  pointed by "pCertStore".
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose CertStore is fetched. Must be non-NULL.
 *  "pTrustCertStore"
 *      Address where CertStore will be stored and returned. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetTrustCertStore(
        PKIX_PL_Cert *cert,
        PKIX_CertStore **pTrustCertStore,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Cert_SetTrustCertStore
 * DESCRIPTION:
 *
 *  Set the value of the CertStore "certStore" in "cert".
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert where "certStore" will be stored. Must be non-NULL.
 *  "trustCertStore"
 *      Address where the CertStore is. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_SetTrustCertStore(
        PKIX_PL_Cert *cert,
        PKIX_CertStore *trustCertStore,
        void *plContext);


/*
 * FUNCTION: PKIX_PL_Cert_GetAuthorityInfoAccess
 * DESCRIPTION:
 *
 *  Retrieves the value(s) of the Authority Information Access in "cert" and
 *  returns it in a list at address pointed by "pAuthorityInfoAccess".
 *
 *  SubjectInfoAccess ::=
 *    SEQUENCE SIZE (1..MAX) of AccessDescription
 *    AccessDescription ::= SEQUENCE {
 *        accessMethod     OBJECT IDENTIFIER,
 *        accessLocation   GeneralName
 *    }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose Authority Information Access is fetched.
 *      Must be non-NULL.
 *  "pAuthorityInfoAccess"
 *      Address where Authority InfoAccess will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetAuthorityInfoAccess(
        PKIX_PL_Cert *cert,
        PKIX_List **pAiaList, /* of PKIX_PL_InfoAccess */
        void *plContext);


/*
 * FUNCTION: PKIX_PL_Cert_GetSubjectInfoAccess
 * DESCRIPTION:
 *
 *  Retrieves the value(s) of the Subject Information Access in "cert" and
 *  returns it in a list at address pointed by "pSubjectInfoAccess".
 *
 *  SubjectInfoAccess ::=
 *    SEQUENCE SIZE (1..MAX) of AccessDescription
 *    AccessDescription ::= SEQUENCE {
 *        accessMethod     OBJECT IDENTIFIER,
 *        accessLocation   GeneralName
 *    }
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose Subject Information Access is fetched.
 *      Must be non-NULL.
 *  "pSubjectInfoAccess"
 *      Address where Subject InfoAccess will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetSubjectInfoAccess(
        PKIX_PL_Cert *cert,
        PKIX_List **pSiaList, /* of PKIX_PL_InfoAccess */
        void *plContext);



/*
 * FUNCTION: PKIX_PL_Cert_GetCrlDp
 * DESCRIPTION:
 *
 *  Retrieves the value(s) of the CRL Distribution Point Extension and
 *  returns it in a list at address pointed by "pDpList".
 *
 * PARAMETERS:
 *  "cert"
 *      Address of Cert whose Subject Information Access is fetched.
 *      Must be non-NULL.
 *  "pDpList"
 *      Address where CRL DP will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Cert_GetCrlDp(PKIX_PL_Cert *cert,
                      PKIX_List **pDpList,
                      void *plContext);


/*
 * InfoAccess 
 *
 * To hold Authority Information Access or Subject Information Access
 * retrieved from a Certificate.
 */

#define PKIX_INFOACCESS_OCSP          1
#define PKIX_INFOACCESS_CA_ISSUERS    2
#define PKIX_INFOACCESS_TIMESTAMPING  3
#define PKIX_INFOACCESS_CA_REPOSITORY 5

#define PKIX_INFOACCESS_LOCATION_UNKNOWN 0
#define PKIX_INFOACCESS_LOCATION_HTTP    1
#ifndef NSS_PKIX_NO_LDAP
#define PKIX_INFOACCESS_LOCATION_LDAP    2
#endif

/*
 * FUNCTION: PKIX_PL_InfoAccess_GetMethod
 * DESCRIPTION:
 *
 *  Stores the method of the Information Access from "infoAccess" and
 *  returns in "pMethod".
 *
 *  SubjectInfoAccess ::=
 *    AccessDescription ::= SEQUENCE {
 *        accessMethod     OBJECT IDENTIFIER,
 *        accessLocation   GeneralName
 *    }
 *
 * PARAMETERS:
 *  "infoAccess"
 *      Address of PKIX_PL_InfoAccess that has the access data.
 *      Must be non-NULL.
 *  "pMethod"
 *      Address where access method will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_InfoAccess_GetMethod(
        PKIX_PL_InfoAccess *infoAccess,
        PKIX_UInt32 *pMethod,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_InfoAccess_GetLocation
 * DESCRIPTION:
 *
 *  Stores the location of the Information Access from "infoAccess" and
 *  returns in "pLocation".
 *
 *  SubjectInfoAccess ::=
 *    AccessDescription ::= SEQUENCE {
 *        accessMethod     OBJECT IDENTIFIER,
 *        accessLocation   GeneralName
 *    }
 *
 * PARAMETERS:
 *  "infoAccess"
 *      Address of PKIX_PL_InfoAccess that has the access data.
 *      Must be non-NULL.
 *  "pLocation"
 *      Address where access location will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_InfoAccess_GetLocation(
        PKIX_PL_InfoAccess *infoAccess,
        PKIX_PL_GeneralName **pLocation,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_InfoAccess_GetLocationType
 * DESCRIPTION:
 *
 *  Stores the type of location of the Information Access from "infoAccess" and
 *  returns in "pType".
 *
 *  SubjectInfoAccess ::=
 *    AccessDescription ::= SEQUENCE {
 *        accessMethod     OBJECT IDENTIFIER,
 *        accessLocation   GeneralName
 *    }
 *
 * PARAMETERS:
 *  "infoAccess"
 *      Address of PKIX_PL_InfoAccess that has the access data.
 *      Must be non-NULL.
 *  "pType"
 *      Address where access location type will be stored and returned.
 *      Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Cert Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_InfoAccess_GetLocationType(
        PKIX_PL_InfoAccess *infoAccess,
        PKIX_UInt32 *pType,
        void *plContext);

PKIX_Error *
pkix_pl_InfoAccess_GetAIACerts(
        PKIX_PL_InfoAccess *ia,
        void **pNBIOContext,
        void **pHandle,
        PKIX_List **pCerts,
        void *plContext);

/*
 * CRL
 *
 * A CRL represents an X.509 certificate revocation list. It can be created
 * using the bytes of a valid ASN.1 DER encoding. Once created, a CRL is
 * immutable. The following functions include accessors (gettors) for the
 * various components of an X.509 CRL, as well as a function for signature
 * verification.
 */

/*
 * FUNCTION: PKIX_PL_CRL_Create
 * DESCRIPTION:
 *
 *  Creates a new CRL using the bytes in the ByteArray pointed to by
 *  "byteArray" and stores it at "pCRL". If the bytes are not a valid ASN.1
 *  DER encoding of a CRL, a PKIX_Error pointer is returned. Once created, a
 *  CRL is immutable.
 *
 *  CertificateList  ::=  SEQUENCE  {
 *      tbsCertList             TBSCertList,
 *      signatureAlgorithm      AlgorithmIdentifier,
 *      signatureValue          BIT STRING  }
 *
 *  TBSCertList  ::=  SEQUENCE  {
 *      version                 Version OPTIONAL,
 *                              -- if present, MUST be v2
 *      signature               AlgorithmIdentifier,
 *      issuer                  Name,
 *      thisUpdate              Time,
 *      nextUpdate              Time OPTIONAL,
 *      revokedCertificates     SEQUENCE OF SEQUENCE  {
 *              userCertificate         CertificateSerialNumber,
 *              revocationDate          Time,
 *              crlEntryExtensions      Extensions OPTIONAL
 *                                      -- if present, MUST be v2
 *                              }  OPTIONAL,
 *      crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
 *                                      -- if present, MUST be v2
 *      }
 *
 * PARAMETERS:
 *  "byteArray"
 *      Address of ByteArray representing the CRL's DER encoding.
 *      Must be non-NULL.
 *  "pCRL"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_Create(
        PKIX_PL_ByteArray *byteArray,
        PKIX_PL_CRL **pCRL,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_GetIssuer
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the X500Name that represents the issuer of the CRL
 *  pointed to by "crl" and stores it at "pCRLIssuer".
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose issuer is to be stored. Must be non-NULL.
 *  "pCRLIssuer"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_GetIssuer(
        PKIX_PL_CRL *crl,
        PKIX_PL_X500Name **pCRLIssuer,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_GetCriticalExtensionOIDs
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of OIDs (each OID corresponding to a
 *  critical extension of the CRL pointed to by "crl") and stores it at
 *  "pExtensions". If "crl" does not have any critical extensions, this
 *  function stores an empty List at "pExtensions".
 *
 *  Note that the List returned by this function is immutable.
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose critical extension OIDs are to be stored.
 *      Must be non-NULL.
 *  "pExtensions"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_GetCriticalExtensionOIDs(
        PKIX_PL_CRL *crl,
        PKIX_List **pExtensions,   /* list of PKIX_PL_OID */
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_GetCRLEntryForSerialNumber
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the CRLEntry (found in the CRL pointed to by "crl")
 *  corresponding to the BigInt pointed to by "serialNumber" and stores it at
 *  "pCRLEntry". If there is no such CRLEntry, this functions stores NULL at
 *  "pCRLEntry". Once created, a CRLEntry is immutable.
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose CRL Entries are to be searched. Must be non-NULL.
 *  "serialNumber"
 *      Address of BigInt representing serial number of certificate whose
 *      CRLEntry is to be found. Must be non-NULL.
 *  "pCRLEntry"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_GetCRLEntryForSerialNumber(
        PKIX_PL_CRL *crl,
        PKIX_PL_BigInt *serialNumber,
        PKIX_PL_CRLEntry **pCRLEntry,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_GetCRLNumber
 * DESCRIPTION:
 *  Retrieves the CRL Number from extension. This is non-critical extension.
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose version is to be stored. Must be non-NULL.
 *  "pCrlNumber"
 *      Address where a CRL Number will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_GetCRLNumber(
        PKIX_PL_CRL *crl,
        PKIX_PL_BigInt **pCrlNumber,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_VerifyUpdateTime
 * DESCRIPTION:
 *
 *  Checks whether the CRL pointed to by "crl" would be valid at the time
 *  represented by the Date pointed to by "date" and stores the Boolean result
 *  at "pResult". This check is done only when NIST policy is enforced.
 *
 *  Time ::= CHOICE {
 *      utcTime         UTCTime,
 *      generalTime     GeneralizedTime }
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose validity is to be checked. Must be non-NULL.
 *  "date"
 *      Address of Date at which the CRL is being checked for validity.
 *      Must be non-NULL.
 *  "pResult"
 *      Address of Boolean result. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_VerifyUpdateTime(
        PKIX_PL_CRL *crl,
        PKIX_PL_Date *date,
        PKIX_Boolean *pResult,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_VerifySignature
 * DESCRIPTION:
 *
 *  Verifies the signature on the CRL pointed to by "crl" using the PublicKey
 *  pointed to by "pubKey". If the signature doesn't verify, a PKIX_Error
 *  pointer is returned.
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose signature is to be verified. Must be non-NULL.
 *  "pubKey"
 *      Address of a Public Key used to verify the signature. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_VerifySignature(
        PKIX_PL_CRL *crl,
        PKIX_PL_PublicKey *pubKey,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRL_ReleaseDerCrl
 * DESCRIPTION:
 *
 * Relinguish the ownership for the crl der. The operation will succeed if
 * a crl owns the der. If the crl was created from existing crl and does not
 * own the der, then the function will return null.
 *
 * PARAMETERS:
 *  "crl"
 *      Address of CRL whose signature is to be verified. Must be non-NULL.
 *  "derCrl"
 *      Pointer to a SECItem that has der crl.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_ReleaseDerCrl(PKIX_PL_CRL *crl,
                         SECItem **derCrl,
                         void *plContext);
/*
 * FUNCTION: PKIX_PL_CRL_AdoptDerCrl
 * DESCRIPTION:
 *
 * Adopt memory of the der. The secItem that contains der will be
 * freed with destruction of parent pkix crl structure.
 *
 * * PARAMETERS:
 *  "crl"
 *      Address of CRL whose signature is to be verified. Must be non-NULL.
 *  "derCrl"
 *      Pointer to a SECItem that has der crl.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRL_AdoptDerCrl(PKIX_PL_CRL *crl,
                        SECItem *derCrl,
                        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRLEntry_GetCRLEntryReasonCode
 * DESCRIPTION:
 *
 *  Retrieves the value of the reason code extension of the CRLEntry pointed
 *  to by "crlEntry" and stores it at "pReason". If the "crlEntry" has no
 *  reason code extension, this function stores -1 at "pReason".
 *
 *  CRLReason ::= ENUMERATED {
 *      unspecified             (0),
 *      keyCompromise           (1),
 *      cACompromise            (2),
 *      affiliationChanged      (3),
 *      superseded              (4),
 *      cessationOfOperation    (5),
 *      certificateHold         (6),
 *      removeFromCRL           (8),
 *      privilegeWithdrawn      (9),
 *      aACompromise            (10) }
 *
 * PARAMETERS:
 *  "crlEntry"
 *      Address of CRLEntry whose reason code bit values are to be returned
 *      at "pReason". Must be non-NULL.
 *  "pReason"
 *      Address of PKIX_Int32 where reason code is stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRLEntry_GetCRLEntryReasonCode(
        PKIX_PL_CRLEntry *crlEntry,
        PKIX_Int32 *pReason,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_CRLEntry_GetCriticalExtensionOIDs
 * DESCRIPTION:
 *
 *  Retrieves a pointer to the List of OIDs (each OID corresponding to a
 *  critical extension of the CRLEntry pointed to by "crlEntry") and stores it
 *  at "pExtensions". If "crlEntry" does not have any critical extensions, this
 *  function stores an empty List at "pExtensions".
 *
 *  Note that the List returned by this function is immutable.
 *
 * PARAMETERS:
 *  "crlEntry"
 *      Address of CRLEntry whose critical extension OIDs are to be stored.
 *      Must be non-NULL.
 *  "pExtensions"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a CRL Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CRLEntry_GetCriticalExtensionOIDs(
        PKIX_PL_CRLEntry *crlEntry,
        PKIX_List **pExtensions,  /* list of PKIX_PL_OID */
        void *plContext);

#ifdef BUILD_LIBPKIX_TESTS
/*
 * FUNCTION: PKIX_PL_X500Name_Create
 * DESCRIPTION:
 *
 *  Creates a new X500Name using the UTF8 string representation pointed to by
 *  "stringRep" and stores it at "pName". Once created, an X500Name is
 *  immutable.
 *
 *  Name ::= CHOICE {
 *    RDNSequence }
 *
 *  RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
 *
 *  RelativeDistinguishedName ::=
 *    SET OF AttributeTypeAndValue
 *
 *  AttributeTypeAndValue ::= SEQUENCE {
 *      type    AttributeType,
 *      value   AttributeValue }
 *
 *  AttributeType ::= OBJECT IDENTIFIER
 *
 *  AttributeValue ::= ANY DEFINED BY AttributeType
 *
 *  DirectoryString ::= CHOICE {
 *      teletexString           TeletexString (SIZE (1..MAX)),
 *      printableString         PrintableString (SIZE (1..MAX)),
 *      universalString         UniversalString (SIZE (1..MAX)),
 *      utf8String              UTF8String (SIZE (1..MAX)),
 *      bmpString               BMPString (SIZE (1..MAX)) }
 *
 * PARAMETERS:
 *  "stringRep"
 *      Address of UTF8 String representation of X500Name. Must be non-NULL.
 *  "pName"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns an X500Name Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_X500Name_Create (
        PKIX_PL_String *stringRep,
        PKIX_PL_X500Name **pName,
        void *plContext);

#endif /* BUILD_LIBPKIX_TESTS */

/*
 * FUNCTION: PKIX_PL_X500Name_CreateFromCERTName
 * DESCRIPTION:
 * 
 * The function creates x500Name using der encoded DN and/or pointer to
 * CERTName. If arument "name" is NULL, but derName is supplied when
 * the function generates nssDN(CERTName type) from der data. If derName
 * is not supplied, CERTName *name will not be used to generate DN DER
 * encoding.
 *
 * PARAMETERS:
 *  "derName"
 *      Address of DER representation of X500Name. Can be NULL
 *  "name"
 *      Address of CERTName representation of X500Name. Can be NULL
 *  "pName"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns an X500Name Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_X500Name_CreateFromCERTName(
        SECItem *derName,
        CERTName *name,
        PKIX_PL_X500Name **pName,
        void *plContext);


/*
 * TYPE: PKIX_PL_X500Name_Match
 * DESCRIPTION:
 *  Checks whether the X500Name pointed to by "firstX500Name" MATCHES the
 *  X500Name pointed to by "secondX500Name" and stores the boolean result at
 *  "pResult". Two X500Names MATCH if they meet the conditions specified by
 *  RFC 3280 (section 4.1.2.4). Namely:
 *
 *      "This specification requires only a subset of the name comparison
 *      functionality specified in the X.500 series of specifications.
 *      Conforming implementations are REQUIRED to implement the following
 *      name comparison rules:
 *
 *      (a)  attribute values encoded in different types (e.g., PrintableString
 *      and BMPString) MAY be assumed to represent different strings;
 *
 *      (b) attribute values in types other than PrintableString are case
 *      sensitive (this permits matching of attribute values as binary objects)
 *
 *      (c)  attribute values in PrintableString are not case sensitive
 *      (e.g., "Marianne Swanson" is the same as "MARIANNE SWANSON"); and
 *
 *      (d)  attribute values in PrintableString are compared after removing
 *      leading and trailing white space and converting internal substrings of
 *      one or more consecutive white space characters to a single space."
 *
 * PARAMETERS:
 *  "firstX500Name"
 *      Address of first X500Name to compare. Must be non-NULL.
 *  "secondX500Name"
 *      Address of second X500Name to compare. Must be non-NULL.
 *  "pResult"
 *      Address of Boolean result. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns an X500Name Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_X500Name_Match(
        PKIX_PL_X500Name *firstX500Name,
        PKIX_PL_X500Name *secondX500Name,
        PKIX_Boolean *pResult,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Date_Create_UTCTime
 * DESCRIPTION:
 *  Creates a new Date of type UTCTime using the string representation pointed
 *  to by "stringRep" and stores it at "pDate". The UTCTime restriction means
 *  that the year can only be specified by the least significant two digits
 *  (YY). As such, Only the years 1950-2049 can be represented. If "stringRep"
 *  is NULL, this function creates a new Date representing the current time
 *  and stores it at "pDate". Once created, a Date is immutable.
 *
 *  If YY is greater than or equal to 50, the year is interpreted as 19YY.
 *  If YY is less than 50, the year is interpreted as 20YY.
 *
 *  The string representation of the date must be in the following form:
 *      "YYMMDDhhmmssZ" where:
 *
 *  YY is the least significant two digits of the year
 *  MM is the month (01 to 12)
 *  DD is the day (01 to 31)
 *  hh is the hour (00 to 23)
 *  mm are the minutes (00 to 59)
 *  ss are the seconds (00 to 59)
 *  Z indicates that local time is GMT
 *
 * PARAMETERS:
 *  "stringRep"
 *      Address of String representation of Date.
 *      If NULL, current time is used.
 *  "pDate"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Date Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Date_Create_UTCTime (
        PKIX_PL_String *stringRep,
        PKIX_PL_Date **pDate,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Date_Create_UTCTime
 * DESCRIPTION:
 *  Creates a new Date from PRTime data.
 *
 * PARAMETERS:
 *  "time"
 *      Represented time in PRTime type.
 *  "pDate"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Date Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Date_CreateFromPRTime(
        PRTime time,
        PKIX_PL_Date **pDate,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_Date_Create_CurrentOffBySeconds
 * DESCRIPTION:
 *  Creates a new Date of type UTCTime for current time with seconds off by
 *  "secondsOffset" and returns it at "pDate".
 *
 * PARAMETERS:
 *  "secondsOffset"
 *      A PKIX_Int32 indicates the time offset from current. If "secondsOffset"
 *      is negative, the time is in past.
 *  "pDate"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a Date Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_Date_Create_CurrentOffBySeconds(
        PKIX_Int32 secondsOffset,
        PKIX_PL_Date **pDate,
        void *plContext);

#ifdef BUILD_LIBPKIX_TESTS
/*
 * FUNCTION: PKIX_PL_GeneralName_Create
 * DESCRIPTION:
 *
 *  Creates a new GeneralName of type "nameType" using the string
 *  representation pointed to by "stringRep" and stores it at "pGName".
 *  All of the GeneralName type format values specified in pkixt.h are
 *  supported, with the exception of PKIX_OTHER_NAME, PKIX_EDIPARTY_NAME,
 *  PKIX_IP_NAME, and PKIX_X400_ADDRESS. A PKIX_ESCASCII string representation
 *  should be used for all supported nameTypes, with the exception of
 *  registeredID and directoryName. For registeredID, the string representation
 *  should be the same as that used by PKIX_PL_OID_Create. For directoryName,
 *  the string representation should be the same as that used by
 *  PKIX_PL_X500Name_Create. If an unsupported name type is used, an Error is
 *  returned. Once created, a GeneralName is immutable.
 *
 *  GeneralName ::= CHOICE {
 *      otherName                       [0]     OtherName,
 *      rfc822Name                      [1]     IA5String,
 *      dNSName                         [2]     IA5String,
 *      x400Address                     [3]     ORAddress,
 *      directoryName                   [4]     Name,
 *      ediPartyName                    [5]     EDIPartyName,
 *      uniformResourceIdentifier       [6]     IA5String,
 *      iPAddress                       [7]     OCTET STRING,
 *      registeredID                    [8]     OBJECT IDENTIFIER }
 *
 *
 * NOTE: This function is allowed to be called only by pkix tests programs.
 * 
 * PARAMETERS:
 *  "nameType"
 *      Type of GeneralName to be created. This must be one of the GeneralName
 *      type format values specified in pkixt.h
 *  "stringRep"
 *      Address of String representation of GeneralName. Must be non-NULL.
 *  "pGName"
 *      Address where object pointer will be stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a GeneralName Error if the function fails in a non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_GeneralName_Create (
        PKIX_UInt32 nameType,
        PKIX_PL_String *stringRep,
        PKIX_PL_GeneralName **pGName,
        void *plContext);
#endif /* BUILD_LIBPKIX_TESTS */

/*
 * FUNCTION: PKIX_PL_CertNameConstraints_CheckNamesInNameSpace
 * DESCRIPTION:
 *
 *  This function checks whether names in "nameList" comply with
 *  "nameConstraints". It stores PKIX_TRUE at "pCheckPass" if the names meet the
 *  requirement of the NameConstraints, PKIX_FALSE otherwise.
 *
 * PARAMETERS
 *  "nameList"
 *      List of GeneralNames that are checked for compliance. May be empty
 *      or NULL.
 *  "nameConstraints"
 *      Address of CertNameConstraints that provides lists of permitted
 *      and excluded names. Must be non-NULL.
 *  "pCheckPass"
 *      Address where PKIX_TRUE is returned if the all names in "nameList" are
 *      valid. Must be non-NULL.
 *  "plContext" - Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns a NameConstraints Error if the function fails in a
 *  non-fatal way.
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_CertNameConstraints_CheckNamesInNameSpace(
        PKIX_List *nameList, /* List of PKIX_PL_GeneralName */
        PKIX_PL_CertNameConstraints *nameConstraints,
        PKIX_Boolean *pCheckPass,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_AIAMgr_Create
 * DESCRIPTION:
 *
 *  This function creates an AIAMgr to handle retrieval of Certs and CRLs
 *  from servers given by AIA Certificate extensions. It manages connections
 *  and caches. The manager created is stored at "pAIAMgr".
 *
 * PARAMETERS:
 *  "pAIAMgr"
 *      The address at which the result is stored. Must be non-NULL.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns an AIAMgr Error if the function fails in a non-fatal way
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_AIAMgr_Create(
        PKIX_PL_AIAMgr **pAIAMgr,
        void *plContext);

/*
 * FUNCTION: PKIX_PL_AIAMgr_GetAIACerts
 * DESCRIPTION:
 *
 *  This function uses the AIAMgr pointed to by "aiaMgr" to retrieve the Certs
 *  specified by an AIA certificate extension, if any, in the Cert pointed to by
 *  "prevCert", storing the results at "pCerts". If the certificate has no such
 *  extension, this function stores NULL at "pCerts".
 *
 *  If the request is suspended for non-blocking I/O, a platform-dependent
 *  context is stored at "pNBIOContext" and NULL is stored at "pCerts". This
 *  return is referred to as the WOULDBLOCK state. Note that the caller must
 *  check for a non-NULL value at "pNBIOContext", to distinguish this state from
 *  the "no such extension" return described in the first paragraph. (The
 *  alternative would be to return an empty List, but it seemed wrong to incur
 *  the overhead of creating and destroying an empty List for the most common
 *  situation.)
 *
 *  After a WOULDBLOCK return, the user may continue the operation by calling
 *  pkix_AIAMgr_GetAIACerts (possibly more than once, if the function again
 *  returns in the WOULDBLOCK state) with the previously-returned non-NULL
 *  value of "pNBIOContext". When results are complete, NULL is stored at
 *  "pNBIOContext", and the results (which may be NULL) are stored at "pCerts".
 *
 * PARAMETERS:
 *  "aiaMgr"
 *      The AIAMgr which controls the retrieval of certificates. Must be
 *      non-NULL.
 *  "prevCert"
 *      Address of PKIX_PL_Cert which may provide an AIA or SIA extension. Must
 *      be non-NULL.
 *  "pNBIOContext"
 *      Address at which platform-dependent information is returned if request
 *      is suspended for non-blocking I/O. Must be non-NULL.
 *  "pCerts"
 *      Address at which the returned List is stored. Must be non-NULL.
 *  "plContext"
 *      Platform-specific context pointer.
 * THREAD SAFETY:
 *  Thread Safe (see Thread Safety Definitions in Programmer's Guide)
 * RETURNS:
 *  Returns NULL if the function succeeds.
 *  Returns an AIAMgr Error if the function fails in a non-fatal way
 *  Returns a Fatal Error if the function fails in an unrecoverable way.
 */
PKIX_Error *
PKIX_PL_AIAMgr_GetAIACerts(
        PKIX_PL_AIAMgr *aiaMgr,
        PKIX_PL_Cert *prevCert,
        void **pNBIOContext,
        PKIX_List **pCerts,
        void *plContext);

typedef PKIX_Error *
(*PKIX_PL_VerifyCallback)(
        PKIX_PL_Object *signedObject,
        PKIX_PL_Cert *signerCert, /* can be unknown */
        PKIX_PL_Date *producedAt,
        PKIX_ProcessingParams *procParams,
        void **pNBIOContext,
        void **pState,
        PKIX_BuildResult **pBuildResult,
        PKIX_VerifyNode **pVerifyTree,
        void *plContext);

#ifdef __cplusplus
}
#endif

#endif /* _PKIX_PL_PKI_H */