summaryrefslogtreecommitdiffstats
path: root/security/nss/lib/util/secoid.c
blob: 800cc7ff6213f30a6f11ca4c8f4e24c4e0dc7d17 (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
/* 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/. */

#include "secoid.h"
#include "pkcs11t.h"
#include "secitem.h"
#include "secerr.h"
#include "prenv.h"
#include "plhash.h"
#include "nssrwlk.h"
#include "nssutil.h"
#include "secoidt.h"

/* Library identity and versioning */

#if defined(DEBUG)
#define _DEBUG_STRING " (debug)"
#else
#define _DEBUG_STRING ""
#endif

/*
 * Version information
 */
const char __nss_util_version[] = "Version: NSS " NSSUTIL_VERSION _DEBUG_STRING;

/* MISSI Mosaic Object ID space */
/* USGov algorithm OID space: { 2 16 840 1 101 } */
#define USGOV 0x60, 0x86, 0x48, 0x01, 0x65
#define MISSI USGOV, 0x02, 0x01, 0x01
#define MISSI_OLD_KEA_DSS MISSI, 0x0c
#define MISSI_OLD_DSS MISSI, 0x02
#define MISSI_KEA_DSS MISSI, 0x14
#define MISSI_DSS MISSI, 0x13
#define MISSI_KEA MISSI, 0x0a
#define MISSI_ALT_KEA MISSI, 0x16

#define NISTALGS USGOV, 3, 4
#define AES NISTALGS, 1
#define SHAXXX NISTALGS, 2
#define DSA2 NISTALGS, 3

/**
 ** The Netscape OID space is allocated by Terry Hayes.  If you need
 ** a piece of the space, contact him at thayes@netscape.com.
 **/

/* Netscape Communications Corporation Object ID space */
/* { 2 16 840 1 113730 } */
#define NETSCAPE_OID 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42
#define NETSCAPE_CERT_EXT NETSCAPE_OID, 0x01
#define NETSCAPE_DATA_TYPE NETSCAPE_OID, 0x02
/* netscape directory oid - owned by Mark Smith (mcs@netscape.com) */
#define NETSCAPE_DIRECTORY NETSCAPE_OID, 0x03
#define NETSCAPE_POLICY NETSCAPE_OID, 0x04
#define NETSCAPE_CERT_SERVER NETSCAPE_OID, 0x05
#define NETSCAPE_ALGS NETSCAPE_OID, 0x06 /* algorithm OIDs */
#define NETSCAPE_NAME_COMPONENTS NETSCAPE_OID, 0x07

#define NETSCAPE_CERT_EXT_AIA NETSCAPE_CERT_EXT, 0x10
#define NETSCAPE_CERT_SERVER_CRMF NETSCAPE_CERT_SERVER, 0x01

/* these are old and should go away soon */
#define OLD_NETSCAPE 0x60, 0x86, 0x48, 0xd8, 0x6a
#define NS_CERT_EXT OLD_NETSCAPE, 0x01
#define NS_FILE_TYPE OLD_NETSCAPE, 0x02
#define NS_IMAGE_TYPE OLD_NETSCAPE, 0x03

/* RSA OID name space */
#define RSADSI 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d
#define PKCS RSADSI, 0x01
#define DIGEST RSADSI, 0x02
#define CIPHER RSADSI, 0x03
#define PKCS1 PKCS, 0x01
#define PKCS5 PKCS, 0x05
#define PKCS7 PKCS, 0x07
#define PKCS9 PKCS, 0x09
#define PKCS12 PKCS, 0x0c

/* Other OID name spaces */
#define ALGORITHM 0x2b, 0x0e, 0x03, 0x02
#define X500 0x55
#define X520_ATTRIBUTE_TYPE X500, 0x04
#define X500_ALG X500, 0x08
#define X500_ALG_ENCRYPTION X500_ALG, 0x01

/** X.509 v3 Extension OID
 ** {joint-iso-ccitt (2) ds(5) 29}
 **/
#define ID_CE_OID X500, 0x1d

#define RFC1274_ATTR_TYPE 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x1
/* #define RFC2247_ATTR_TYPE  0x09, 0x92, 0x26, 0xf5, 0x98, 0x1e, 0x64, 0x1 this is WRONG! */

/* PKCS #12 name spaces */
#define PKCS12_MODE_IDS PKCS12, 0x01
#define PKCS12_ESPVK_IDS PKCS12, 0x02
#define PKCS12_BAG_IDS PKCS12, 0x03
#define PKCS12_CERT_BAG_IDS PKCS12, 0x04
#define PKCS12_OIDS PKCS12, 0x05
#define PKCS12_PBE_IDS PKCS12_OIDS, 0x01
#define PKCS12_ENVELOPING_IDS PKCS12_OIDS, 0x02
#define PKCS12_SIGNATURE_IDS PKCS12_OIDS, 0x03
#define PKCS12_V2_PBE_IDS PKCS12, 0x01
#define PKCS9_CERT_TYPES PKCS9, 0x16
#define PKCS9_CRL_TYPES PKCS9, 0x17
#define PKCS9_SMIME_IDS PKCS9, 0x10
#define PKCS9_SMIME_ATTRS PKCS9_SMIME_IDS, 2
#define PKCS9_SMIME_ALGS PKCS9_SMIME_IDS, 3
#define PKCS12_VERSION1 PKCS12, 0x0a
#define PKCS12_V1_BAG_IDS PKCS12_VERSION1, 1

/* for DSA algorithm */
/* { iso(1) member-body(2) us(840) x9-57(10040) x9algorithm(4) } */
#define ANSI_X9_ALGORITHM 0x2a, 0x86, 0x48, 0xce, 0x38, 0x4

/* for DH algorithm */
/* { iso(1) member-body(2) us(840) x9-57(10046) number-type(2) } */
/* need real OID person to look at this, copied the above line
 * and added 6 to second to last value (and changed '4' to '2' */
#define ANSI_X942_ALGORITHM 0x2a, 0x86, 0x48, 0xce, 0x3e, 0x2

#define VERISIGN 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x45

#define INTERNET_SECURITY_MECH 0x2b, 0x06, 0x01, 0x05, 0x05

#define PKIX INTERNET_SECURITY_MECH, 0x07
#define PKIX_CERT_EXTENSIONS PKIX, 1
#define PKIX_POLICY_QUALIFIERS PKIX, 2
#define PKIX_KEY_USAGE PKIX, 3
#define PKIX_ACCESS_DESCRIPTION PKIX, 0x30
#define PKIX_OCSP PKIX_ACCESS_DESCRIPTION, 1
#define PKIX_CA_ISSUERS PKIX_ACCESS_DESCRIPTION, 2

#define PKIX_ID_PKIP PKIX, 5
#define PKIX_ID_REGCTRL PKIX_ID_PKIP, 1
#define PKIX_ID_REGINFO PKIX_ID_PKIP, 2

/* Microsoft Object ID space */
/* { 1.3.6.1.4.1.311 } */
#define MICROSOFT_OID 0x2b, 0x6, 0x1, 0x4, 0x1, 0x82, 0x37
#define EV_NAME_ATTRIBUTE MICROSOFT_OID, 60, 2, 1

/* Microsoft Crypto 2.0 ID space */
/* { 1.3.6.1.4.1.311.10 } */
#define MS_CRYPTO_20 MICROSOFT_OID, 10
/* Microsoft Crypto 2.0 Extended Key Usage ID space */
/* { 1.3.6.1.4.1.311.10.3 } */
#define MS_CRYPTO_EKU MS_CRYPTO_20, 3

#define CERTICOM_OID 0x2b, 0x81, 0x04
#define SECG_OID CERTICOM_OID, 0x00

#define ANSI_X962_OID 0x2a, 0x86, 0x48, 0xce, 0x3d
#define ANSI_X962_CURVE_OID ANSI_X962_OID, 0x03
#define ANSI_X962_GF2m_OID ANSI_X962_CURVE_OID, 0x00
#define ANSI_X962_GFp_OID ANSI_X962_CURVE_OID, 0x01
#define ANSI_X962_SIGNATURE_OID ANSI_X962_OID, 0x04
#define ANSI_X962_SPECIFY_OID ANSI_X962_SIGNATURE_OID, 0x03

/* for Camellia: iso(1) member-body(2) jisc(392)
 *    mitsubishi(200011) isl(61) security(1) algorithm(1)
 */
#define MITSUBISHI_ALG 0x2a, 0x83, 0x08, 0x8c, 0x9a, 0x4b, 0x3d, 0x01, 0x01
#define CAMELLIA_ENCRYPT_OID MITSUBISHI_ALG, 1
#define CAMELLIA_WRAP_OID MITSUBISHI_ALG, 3

/* For IDEA: 1.3.6.1.4.1.188.7.1.1
 */
#define ASCOM_OID 0x2b, 0x6, 0x1, 0x4, 0x1, 0xbc
#define ASCOM_IDEA_ALG ASCOM_OID, 0x7, 0x1, 0x1

/* for SEED : iso(1) member-body(2) korea(410)
 *    kisa(200004) algorithm(1)
 */
#define SEED_OID 0x2a, 0x83, 0x1a, 0x8c, 0x9a, 0x44, 0x01

#define CONST_OID static const unsigned char

CONST_OID md2[] = { DIGEST, 0x02 };
CONST_OID md4[] = { DIGEST, 0x04 };
CONST_OID md5[] = { DIGEST, 0x05 };
CONST_OID hmac_sha1[] = { DIGEST, 7 };
CONST_OID hmac_sha224[] = { DIGEST, 8 };
CONST_OID hmac_sha256[] = { DIGEST, 9 };
CONST_OID hmac_sha384[] = { DIGEST, 10 };
CONST_OID hmac_sha512[] = { DIGEST, 11 };

CONST_OID rc2cbc[] = { CIPHER, 0x02 };
CONST_OID rc4[] = { CIPHER, 0x04 };
CONST_OID desede3cbc[] = { CIPHER, 0x07 };
CONST_OID rc5cbcpad[] = { CIPHER, 0x09 };

CONST_OID desecb[] = { ALGORITHM, 0x06 };
CONST_OID descbc[] = { ALGORITHM, 0x07 };
CONST_OID desofb[] = { ALGORITHM, 0x08 };
CONST_OID descfb[] = { ALGORITHM, 0x09 };
CONST_OID desmac[] = { ALGORITHM, 0x0a };
CONST_OID sdn702DSASignature[] = { ALGORITHM, 0x0c };
CONST_OID isoSHAWithRSASignature[] = { ALGORITHM, 0x0f };
CONST_OID desede[] = { ALGORITHM, 0x11 };
CONST_OID sha1[] = { ALGORITHM, 0x1a };
CONST_OID bogusDSASignaturewithSHA1Digest[] = { ALGORITHM, 0x1b };
CONST_OID isoSHA1WithRSASignature[] = { ALGORITHM, 0x1d };

CONST_OID pkcs1RSAEncryption[] = { PKCS1, 0x01 };
CONST_OID pkcs1MD2WithRSAEncryption[] = { PKCS1, 0x02 };
CONST_OID pkcs1MD4WithRSAEncryption[] = { PKCS1, 0x03 };
CONST_OID pkcs1MD5WithRSAEncryption[] = { PKCS1, 0x04 };
CONST_OID pkcs1SHA1WithRSAEncryption[] = { PKCS1, 0x05 };
CONST_OID pkcs1RSAOAEPEncryption[] = { PKCS1, 0x07 };
CONST_OID pkcs1MGF1[] = { PKCS1, 0x08 };
CONST_OID pkcs1PSpecified[] = { PKCS1, 0x09 };
CONST_OID pkcs1RSAPSSSignature[] = { PKCS1, 10 };
CONST_OID pkcs1SHA256WithRSAEncryption[] = { PKCS1, 11 };
CONST_OID pkcs1SHA384WithRSAEncryption[] = { PKCS1, 12 };
CONST_OID pkcs1SHA512WithRSAEncryption[] = { PKCS1, 13 };
CONST_OID pkcs1SHA224WithRSAEncryption[] = { PKCS1, 14 };

CONST_OID pkcs5PbeWithMD2AndDEScbc[] = { PKCS5, 0x01 };
CONST_OID pkcs5PbeWithMD5AndDEScbc[] = { PKCS5, 0x03 };
CONST_OID pkcs5PbeWithSha1AndDEScbc[] = { PKCS5, 0x0a };
CONST_OID pkcs5Pbkdf2[] = { PKCS5, 12 };
CONST_OID pkcs5Pbes2[] = { PKCS5, 13 };
CONST_OID pkcs5Pbmac1[] = { PKCS5, 14 };

CONST_OID pkcs7[] = { PKCS7 };
CONST_OID pkcs7Data[] = { PKCS7, 0x01 };
CONST_OID pkcs7SignedData[] = { PKCS7, 0x02 };
CONST_OID pkcs7EnvelopedData[] = { PKCS7, 0x03 };
CONST_OID pkcs7SignedEnvelopedData[] = { PKCS7, 0x04 };
CONST_OID pkcs7DigestedData[] = { PKCS7, 0x05 };
CONST_OID pkcs7EncryptedData[] = { PKCS7, 0x06 };

CONST_OID pkcs9EmailAddress[] = { PKCS9, 0x01 };
CONST_OID pkcs9UnstructuredName[] = { PKCS9, 0x02 };
CONST_OID pkcs9ContentType[] = { PKCS9, 0x03 };
CONST_OID pkcs9MessageDigest[] = { PKCS9, 0x04 };
CONST_OID pkcs9SigningTime[] = { PKCS9, 0x05 };
CONST_OID pkcs9CounterSignature[] = { PKCS9, 0x06 };
CONST_OID pkcs9ChallengePassword[] = { PKCS9, 0x07 };
CONST_OID pkcs9UnstructuredAddress[] = { PKCS9, 0x08 };
CONST_OID pkcs9ExtendedCertificateAttributes[] = { PKCS9, 0x09 };
CONST_OID pkcs9ExtensionRequest[] = { PKCS9, 14 };
CONST_OID pkcs9SMIMECapabilities[] = { PKCS9, 15 };
CONST_OID pkcs9FriendlyName[] = { PKCS9, 20 };
CONST_OID pkcs9LocalKeyID[] = { PKCS9, 21 };

CONST_OID pkcs9X509Certificate[] = { PKCS9_CERT_TYPES, 1 };
CONST_OID pkcs9SDSICertificate[] = { PKCS9_CERT_TYPES, 2 };
CONST_OID pkcs9X509CRL[] = { PKCS9_CRL_TYPES, 1 };

/* RFC2630 (CMS) OIDs */
CONST_OID cmsESDH[] = { PKCS9_SMIME_ALGS, 5 };
CONST_OID cms3DESwrap[] = { PKCS9_SMIME_ALGS, 6 };
CONST_OID cmsRC2wrap[] = { PKCS9_SMIME_ALGS, 7 };

/* RFC2633 SMIME message attributes */
CONST_OID smimeEncryptionKeyPreference[] = { PKCS9_SMIME_ATTRS, 11 };
CONST_OID ms_smimeEncryptionKeyPreference[] = { MICROSOFT_OID, 0x10, 0x4 };

CONST_OID x520CommonName[] = { X520_ATTRIBUTE_TYPE, 3 };
CONST_OID x520SurName[] = { X520_ATTRIBUTE_TYPE, 4 };
CONST_OID x520SerialNumber[] = { X520_ATTRIBUTE_TYPE, 5 };
CONST_OID x520CountryName[] = { X520_ATTRIBUTE_TYPE, 6 };
CONST_OID x520LocalityName[] = { X520_ATTRIBUTE_TYPE, 7 };
CONST_OID x520StateOrProvinceName[] = { X520_ATTRIBUTE_TYPE, 8 };
CONST_OID x520StreetAddress[] = { X520_ATTRIBUTE_TYPE, 9 };
CONST_OID x520OrgName[] = { X520_ATTRIBUTE_TYPE, 10 };
CONST_OID x520OrgUnitName[] = { X520_ATTRIBUTE_TYPE, 11 };
CONST_OID x520Title[] = { X520_ATTRIBUTE_TYPE, 12 };
CONST_OID x520BusinessCategory[] = { X520_ATTRIBUTE_TYPE, 15 };
CONST_OID x520PostalAddress[] = { X520_ATTRIBUTE_TYPE, 16 };
CONST_OID x520PostalCode[] = { X520_ATTRIBUTE_TYPE, 17 };
CONST_OID x520PostOfficeBox[] = { X520_ATTRIBUTE_TYPE, 18 };
CONST_OID x520Name[] = { X520_ATTRIBUTE_TYPE, 41 };
CONST_OID x520GivenName[] = { X520_ATTRIBUTE_TYPE, 42 };
CONST_OID x520Initials[] = { X520_ATTRIBUTE_TYPE, 43 };
CONST_OID x520GenerationQualifier[] = { X520_ATTRIBUTE_TYPE, 44 };
CONST_OID x520DnQualifier[] = { X520_ATTRIBUTE_TYPE, 46 };
CONST_OID x520HouseIdentifier[] = { X520_ATTRIBUTE_TYPE, 51 };
CONST_OID x520Pseudonym[] = { X520_ATTRIBUTE_TYPE, 65 };

CONST_OID nsTypeGIF[] = { NETSCAPE_DATA_TYPE, 0x01 };
CONST_OID nsTypeJPEG[] = { NETSCAPE_DATA_TYPE, 0x02 };
CONST_OID nsTypeURL[] = { NETSCAPE_DATA_TYPE, 0x03 };
CONST_OID nsTypeHTML[] = { NETSCAPE_DATA_TYPE, 0x04 };
CONST_OID nsTypeCertSeq[] = { NETSCAPE_DATA_TYPE, 0x05 };

CONST_OID missiCertKEADSSOld[] = { MISSI_OLD_KEA_DSS };
CONST_OID missiCertDSSOld[] = { MISSI_OLD_DSS };
CONST_OID missiCertKEADSS[] = { MISSI_KEA_DSS };
CONST_OID missiCertDSS[] = { MISSI_DSS };
CONST_OID missiCertKEA[] = { MISSI_KEA };
CONST_OID missiCertAltKEA[] = { MISSI_ALT_KEA };
CONST_OID x500RSAEncryption[] = { X500_ALG_ENCRYPTION, 0x01 };

/* added for alg 1485 */
CONST_OID rfc1274Uid[] = { RFC1274_ATTR_TYPE, 1 };
CONST_OID rfc1274Mail[] = { RFC1274_ATTR_TYPE, 3 };
CONST_OID rfc2247DomainComponent[] = { RFC1274_ATTR_TYPE, 25 };

/* Netscape private certificate extensions */
CONST_OID nsCertExtNetscapeOK[] = { NS_CERT_EXT, 1 };
CONST_OID nsCertExtIssuerLogo[] = { NS_CERT_EXT, 2 };
CONST_OID nsCertExtSubjectLogo[] = { NS_CERT_EXT, 3 };
CONST_OID nsExtCertType[] = { NETSCAPE_CERT_EXT, 0x01 };
CONST_OID nsExtBaseURL[] = { NETSCAPE_CERT_EXT, 0x02 };
CONST_OID nsExtRevocationURL[] = { NETSCAPE_CERT_EXT, 0x03 };
CONST_OID nsExtCARevocationURL[] = { NETSCAPE_CERT_EXT, 0x04 };
CONST_OID nsExtCACRLURL[] = { NETSCAPE_CERT_EXT, 0x05 };
CONST_OID nsExtCACertURL[] = { NETSCAPE_CERT_EXT, 0x06 };
CONST_OID nsExtCertRenewalURL[] = { NETSCAPE_CERT_EXT, 0x07 };
CONST_OID nsExtCAPolicyURL[] = { NETSCAPE_CERT_EXT, 0x08 };
CONST_OID nsExtHomepageURL[] = { NETSCAPE_CERT_EXT, 0x09 };
CONST_OID nsExtEntityLogo[] = { NETSCAPE_CERT_EXT, 0x0a };
CONST_OID nsExtUserPicture[] = { NETSCAPE_CERT_EXT, 0x0b };
CONST_OID nsExtSSLServerName[] = { NETSCAPE_CERT_EXT, 0x0c };
CONST_OID nsExtComment[] = { NETSCAPE_CERT_EXT, 0x0d };

/* the following 2 extensions are defined for and used by Cartman(NSM) */
CONST_OID nsExtLostPasswordURL[] = { NETSCAPE_CERT_EXT, 0x0e };
CONST_OID nsExtCertRenewalTime[] = { NETSCAPE_CERT_EXT, 0x0f };

CONST_OID nsExtAIACertRenewal[] = { NETSCAPE_CERT_EXT_AIA, 0x01 };
CONST_OID nsExtCertScopeOfUse[] = { NETSCAPE_CERT_EXT, 0x11 };
/* Reserved Netscape (2 16 840 1 113730 1 18) = { NETSCAPE_CERT_EXT, 0x12 }; */

/* Netscape policy values */
CONST_OID nsKeyUsageGovtApproved[] = { NETSCAPE_POLICY, 0x01 };

/* Netscape other name types */
CONST_OID netscapeNickname[] = { NETSCAPE_NAME_COMPONENTS, 0x01 };
CONST_OID netscapeAOLScreenname[] = { NETSCAPE_NAME_COMPONENTS, 0x02 };

/* OIDs needed for cert server */
CONST_OID netscapeRecoveryRequest[] = { NETSCAPE_CERT_SERVER_CRMF, 0x01 };

/* Standard x.509 v3 Certificate & CRL Extensions */
CONST_OID x509SubjectDirectoryAttr[] = { ID_CE_OID, 9 };
CONST_OID x509SubjectKeyID[] = { ID_CE_OID, 14 };
CONST_OID x509KeyUsage[] = { ID_CE_OID, 15 };
CONST_OID x509PrivateKeyUsagePeriod[] = { ID_CE_OID, 16 };
CONST_OID x509SubjectAltName[] = { ID_CE_OID, 17 };
CONST_OID x509IssuerAltName[] = { ID_CE_OID, 18 };
CONST_OID x509BasicConstraints[] = { ID_CE_OID, 19 };
CONST_OID x509CRLNumber[] = { ID_CE_OID, 20 };
CONST_OID x509ReasonCode[] = { ID_CE_OID, 21 };
CONST_OID x509HoldInstructionCode[] = { ID_CE_OID, 23 };
CONST_OID x509InvalidDate[] = { ID_CE_OID, 24 };
CONST_OID x509DeltaCRLIndicator[] = { ID_CE_OID, 27 };
CONST_OID x509IssuingDistributionPoint[] = { ID_CE_OID, 28 };
CONST_OID x509CertIssuer[] = { ID_CE_OID, 29 };
CONST_OID x509NameConstraints[] = { ID_CE_OID, 30 };
CONST_OID x509CRLDistPoints[] = { ID_CE_OID, 31 };
CONST_OID x509CertificatePolicies[] = { ID_CE_OID, 32 };
CONST_OID x509PolicyMappings[] = { ID_CE_OID, 33 };
CONST_OID x509AuthKeyID[] = { ID_CE_OID, 35 };
CONST_OID x509PolicyConstraints[] = { ID_CE_OID, 36 };
CONST_OID x509ExtKeyUsage[] = { ID_CE_OID, 37 };
CONST_OID x509FreshestCRL[] = { ID_CE_OID, 46 };
CONST_OID x509InhibitAnyPolicy[] = { ID_CE_OID, 54 };

CONST_OID x509CertificatePoliciesAnyPolicy[] = { ID_CE_OID, 32, 0 };
CONST_OID x509ExtKeyUsageAnyUsage[] = { ID_CE_OID, 37, 0 };

CONST_OID x509AuthInfoAccess[] = { PKIX_CERT_EXTENSIONS, 1 };
CONST_OID x509SubjectInfoAccess[] = { PKIX_CERT_EXTENSIONS, 11 };

CONST_OID x509SIATimeStamping[] = { PKIX_ACCESS_DESCRIPTION, 0x03 };
CONST_OID x509SIACaRepository[] = { PKIX_ACCESS_DESCRIPTION, 0x05 };

/* pkcs 12 additions */
CONST_OID pkcs12[] = { PKCS12 };
CONST_OID pkcs12ModeIDs[] = { PKCS12_MODE_IDS };
CONST_OID pkcs12ESPVKIDs[] = { PKCS12_ESPVK_IDS };
CONST_OID pkcs12BagIDs[] = { PKCS12_BAG_IDS };
CONST_OID pkcs12CertBagIDs[] = { PKCS12_CERT_BAG_IDS };
CONST_OID pkcs12OIDs[] = { PKCS12_OIDS };
CONST_OID pkcs12PBEIDs[] = { PKCS12_PBE_IDS };
CONST_OID pkcs12EnvelopingIDs[] = { PKCS12_ENVELOPING_IDS };
CONST_OID pkcs12SignatureIDs[] = { PKCS12_SIGNATURE_IDS };
CONST_OID pkcs12PKCS8KeyShrouding[] = { PKCS12_ESPVK_IDS, 0x01 };
CONST_OID pkcs12KeyBagID[] = { PKCS12_BAG_IDS, 0x01 };
CONST_OID pkcs12CertAndCRLBagID[] = { PKCS12_BAG_IDS, 0x02 };
CONST_OID pkcs12SecretBagID[] = { PKCS12_BAG_IDS, 0x03 };
CONST_OID pkcs12X509CertCRLBag[] = { PKCS12_CERT_BAG_IDS, 0x01 };
CONST_OID pkcs12SDSICertBag[] = { PKCS12_CERT_BAG_IDS, 0x02 };
CONST_OID pkcs12PBEWithSha1And128BitRC4[] = { PKCS12_PBE_IDS, 0x01 };
CONST_OID pkcs12PBEWithSha1And40BitRC4[] = { PKCS12_PBE_IDS, 0x02 };
CONST_OID pkcs12PBEWithSha1AndTripleDESCBC[] = { PKCS12_PBE_IDS, 0x03 };
CONST_OID pkcs12PBEWithSha1And128BitRC2CBC[] = { PKCS12_PBE_IDS, 0x04 };
CONST_OID pkcs12PBEWithSha1And40BitRC2CBC[] = { PKCS12_PBE_IDS, 0x05 };
CONST_OID pkcs12RSAEncryptionWith128BitRC4[] = { PKCS12_ENVELOPING_IDS, 0x01 };
CONST_OID pkcs12RSAEncryptionWith40BitRC4[] = { PKCS12_ENVELOPING_IDS, 0x02 };
CONST_OID pkcs12RSAEncryptionWithTripleDES[] = { PKCS12_ENVELOPING_IDS, 0x03 };
CONST_OID pkcs12RSASignatureWithSHA1Digest[] = { PKCS12_SIGNATURE_IDS, 0x01 };

/* pkcs 12 version 1.0 ids */
CONST_OID pkcs12V2PBEWithSha1And128BitRC4[] = { PKCS12_V2_PBE_IDS, 0x01 };
CONST_OID pkcs12V2PBEWithSha1And40BitRC4[] = { PKCS12_V2_PBE_IDS, 0x02 };
CONST_OID pkcs12V2PBEWithSha1And3KeyTripleDEScbc[] = { PKCS12_V2_PBE_IDS, 0x03 };
CONST_OID pkcs12V2PBEWithSha1And2KeyTripleDEScbc[] = { PKCS12_V2_PBE_IDS, 0x04 };
CONST_OID pkcs12V2PBEWithSha1And128BitRC2cbc[] = { PKCS12_V2_PBE_IDS, 0x05 };
CONST_OID pkcs12V2PBEWithSha1And40BitRC2cbc[] = { PKCS12_V2_PBE_IDS, 0x06 };

CONST_OID pkcs12SafeContentsID[] = { PKCS12_BAG_IDS, 0x04 };
CONST_OID pkcs12PKCS8ShroudedKeyBagID[] = { PKCS12_BAG_IDS, 0x05 };

CONST_OID pkcs12V1KeyBag[] = { PKCS12_V1_BAG_IDS, 0x01 };
CONST_OID pkcs12V1PKCS8ShroudedKeyBag[] = { PKCS12_V1_BAG_IDS, 0x02 };
CONST_OID pkcs12V1CertBag[] = { PKCS12_V1_BAG_IDS, 0x03 };
CONST_OID pkcs12V1CRLBag[] = { PKCS12_V1_BAG_IDS, 0x04 };
CONST_OID pkcs12V1SecretBag[] = { PKCS12_V1_BAG_IDS, 0x05 };
CONST_OID pkcs12V1SafeContentsBag[] = { PKCS12_V1_BAG_IDS, 0x06 };

/* The following encoding is INCORRECT, but correcting it would create a
 * duplicate OID in the table.  So, we will leave it alone.
 */
CONST_OID pkcs12KeyUsageAttr[] = { 2, 5, 29, 15 };

CONST_OID ansix9DSASignature[] = { ANSI_X9_ALGORITHM, 0x01 };
CONST_OID ansix9DSASignaturewithSHA1Digest[] = { ANSI_X9_ALGORITHM, 0x03 };
CONST_OID nistDSASignaturewithSHA224Digest[] = { DSA2, 0x01 };
CONST_OID nistDSASignaturewithSHA256Digest[] = { DSA2, 0x02 };

/* verisign OIDs */
CONST_OID verisignUserNotices[] = { VERISIGN, 1, 7, 1, 1 };

/* pkix OIDs */
CONST_OID pkixCPSPointerQualifier[] = { PKIX_POLICY_QUALIFIERS, 1 };
CONST_OID pkixUserNoticeQualifier[] = { PKIX_POLICY_QUALIFIERS, 2 };

CONST_OID pkixOCSP[] = { PKIX_OCSP };
CONST_OID pkixOCSPBasicResponse[] = { PKIX_OCSP, 1 };
CONST_OID pkixOCSPNonce[] = { PKIX_OCSP, 2 };
CONST_OID pkixOCSPCRL[] = { PKIX_OCSP, 3 };
CONST_OID pkixOCSPResponse[] = { PKIX_OCSP, 4 };
CONST_OID pkixOCSPNoCheck[] = { PKIX_OCSP, 5 };
CONST_OID pkixOCSPArchiveCutoff[] = { PKIX_OCSP, 6 };
CONST_OID pkixOCSPServiceLocator[] = { PKIX_OCSP, 7 };

CONST_OID pkixCAIssuers[] = { PKIX_CA_ISSUERS };

CONST_OID pkixRegCtrlRegToken[] = { PKIX_ID_REGCTRL, 1 };
CONST_OID pkixRegCtrlAuthenticator[] = { PKIX_ID_REGCTRL, 2 };
CONST_OID pkixRegCtrlPKIPubInfo[] = { PKIX_ID_REGCTRL, 3 };
CONST_OID pkixRegCtrlPKIArchOptions[] = { PKIX_ID_REGCTRL, 4 };
CONST_OID pkixRegCtrlOldCertID[] = { PKIX_ID_REGCTRL, 5 };
CONST_OID pkixRegCtrlProtEncKey[] = { PKIX_ID_REGCTRL, 6 };
CONST_OID pkixRegInfoUTF8Pairs[] = { PKIX_ID_REGINFO, 1 };
CONST_OID pkixRegInfoCertReq[] = { PKIX_ID_REGINFO, 2 };

CONST_OID pkixExtendedKeyUsageServerAuth[] = { PKIX_KEY_USAGE, 1 };
CONST_OID pkixExtendedKeyUsageClientAuth[] = { PKIX_KEY_USAGE, 2 };
CONST_OID pkixExtendedKeyUsageCodeSign[] = { PKIX_KEY_USAGE, 3 };
CONST_OID pkixExtendedKeyUsageEMailProtect[] = { PKIX_KEY_USAGE, 4 };
/* IPsecEnd, IPsecTunnel, and IPsecUser are deprecated, but still in use
 * (see RFC4945) */
CONST_OID pkixExtendedKeyUsageIPsecEnd[] = { PKIX_KEY_USAGE, 5 };
CONST_OID pkixExtendedKeyUsageIPsecTunnel[] = { PKIX_KEY_USAGE, 6 };
CONST_OID pkixExtendedKeyUsageIPsecUser[] = { PKIX_KEY_USAGE, 7 };
CONST_OID pkixExtendedKeyUsageTimeStamp[] = { PKIX_KEY_USAGE, 8 };
CONST_OID pkixOCSPResponderExtendedKeyUsage[] = { PKIX_KEY_USAGE, 9 };
/* 17 replaces 5 + 6 + 7 (declared obsolete in RFC 4945) */
CONST_OID pkixExtendedKeyUsageIPsecIKE[] = { PKIX_KEY_USAGE, 17 };
CONST_OID msExtendedKeyUsageTrustListSigning[] = { MS_CRYPTO_EKU, 1 };

CONST_OID ipsecIKEEnd[] = { INTERNET_SECURITY_MECH, 0x08, 0x02, 0x01 };
CONST_OID ipsecIKEIntermediate[] = { INTERNET_SECURITY_MECH, 0x08, 0x02, 0x02 };

/* OIDs for Netscape defined algorithms */
CONST_OID netscapeSMimeKEA[] = { NETSCAPE_ALGS, 0x01 };

/* Fortezza algorithm OIDs */
CONST_OID skipjackCBC[] = { MISSI, 0x04 };
CONST_OID dhPublicKey[] = { ANSI_X942_ALGORITHM, 0x1 };

CONST_OID idea_CBC[] = { ASCOM_IDEA_ALG, 2 };
CONST_OID aes128_GCM[] = { AES, 0x6 };
CONST_OID aes192_GCM[] = { AES, 0x1a };
CONST_OID aes256_GCM[] = { AES, 0x2e };
CONST_OID aes128_ECB[] = { AES, 1 };
CONST_OID aes128_CBC[] = { AES, 2 };
#ifdef DEFINE_ALL_AES_CIPHERS
CONST_OID aes128_OFB[] = { AES, 3 };
CONST_OID aes128_CFB[] = { AES, 4 };
#endif
CONST_OID aes128_KEY_WRAP[] = { AES, 5 };

CONST_OID aes192_ECB[] = { AES, 21 };
CONST_OID aes192_CBC[] = { AES, 22 };
#ifdef DEFINE_ALL_AES_CIPHERS
CONST_OID aes192_OFB[] = { AES, 23 };
CONST_OID aes192_CFB[] = { AES, 24 };
#endif
CONST_OID aes192_KEY_WRAP[] = { AES, 25 };

CONST_OID aes256_ECB[] = { AES, 41 };
CONST_OID aes256_CBC[] = { AES, 42 };
#ifdef DEFINE_ALL_AES_CIPHERS
CONST_OID aes256_OFB[] = { AES, 43 };
CONST_OID aes256_CFB[] = { AES, 44 };
#endif
CONST_OID aes256_KEY_WRAP[] = { AES, 45 };

CONST_OID camellia128_CBC[] = { CAMELLIA_ENCRYPT_OID, 2 };
CONST_OID camellia192_CBC[] = { CAMELLIA_ENCRYPT_OID, 3 };
CONST_OID camellia256_CBC[] = { CAMELLIA_ENCRYPT_OID, 4 };

CONST_OID sha256[] = { SHAXXX, 1 };
CONST_OID sha384[] = { SHAXXX, 2 };
CONST_OID sha512[] = { SHAXXX, 3 };
CONST_OID sha224[] = { SHAXXX, 4 };

CONST_OID sha3_224[] = { SHAXXX, 7 };
CONST_OID sha3_256[] = { SHAXXX, 8 };
CONST_OID sha3_384[] = { SHAXXX, 9 };
CONST_OID sha3_512[] = { SHAXXX, 10 };

CONST_OID hmac_sha3_224[] = { SHAXXX, 13 };
CONST_OID hmac_sha3_256[] = { SHAXXX, 14 };
CONST_OID hmac_sha3_384[] = { SHAXXX, 15 };
CONST_OID hmac_sha3_512[] = { SHAXXX, 16 };

CONST_OID ansix962ECPublicKey[] = { ANSI_X962_OID, 0x02, 0x01 };
CONST_OID ansix962SignaturewithSHA1Digest[] = { ANSI_X962_SIGNATURE_OID, 0x01 };
CONST_OID ansix962SignatureRecommended[] = { ANSI_X962_SIGNATURE_OID, 0x02 };
CONST_OID ansix962SignatureSpecified[] = { ANSI_X962_SPECIFY_OID };
CONST_OID ansix962SignaturewithSHA224Digest[] = { ANSI_X962_SPECIFY_OID, 0x01 };
CONST_OID ansix962SignaturewithSHA256Digest[] = { ANSI_X962_SPECIFY_OID, 0x02 };
CONST_OID ansix962SignaturewithSHA384Digest[] = { ANSI_X962_SPECIFY_OID, 0x03 };
CONST_OID ansix962SignaturewithSHA512Digest[] = { ANSI_X962_SPECIFY_OID, 0x04 };

/* ANSI X9.62 prime curve OIDs */
/* NOTE: prime192v1 is the same as secp192r1, prime256v1 is the
 * same as secp256r1
 */
CONST_OID ansiX962prime192v1[] = { ANSI_X962_GFp_OID, 0x01 }; /* unsupported by freebl */
CONST_OID ansiX962prime192v2[] = { ANSI_X962_GFp_OID, 0x02 }; /* unsupported by freebl */
CONST_OID ansiX962prime192v3[] = { ANSI_X962_GFp_OID, 0x03 }; /* unsupported by freebl */
CONST_OID ansiX962prime239v1[] = { ANSI_X962_GFp_OID, 0x04 }; /* unsupported by freebl */
CONST_OID ansiX962prime239v2[] = { ANSI_X962_GFp_OID, 0x05 }; /* unsupported by freebl */
CONST_OID ansiX962prime239v3[] = { ANSI_X962_GFp_OID, 0x06 }; /* unsupported by freebl */
CONST_OID ansiX962prime256v1[] = { ANSI_X962_GFp_OID, 0x07 };

/* SECG prime curve OIDs */
CONST_OID secgECsecp112r1[] = { SECG_OID, 0x06 }; /* unsupported by freebl */
CONST_OID secgECsecp112r2[] = { SECG_OID, 0x07 }; /* unsupported by freebl */
CONST_OID secgECsecp128r1[] = { SECG_OID, 0x1c }; /* unsupported by freebl */
CONST_OID secgECsecp128r2[] = { SECG_OID, 0x1d }; /* unsupported by freebl */
CONST_OID secgECsecp160k1[] = { SECG_OID, 0x09 }; /* unsupported by freebl */
CONST_OID secgECsecp160r1[] = { SECG_OID, 0x08 }; /* unsupported by freebl */
CONST_OID secgECsecp160r2[] = { SECG_OID, 0x1e }; /* unsupported by freebl */
CONST_OID secgECsecp192k1[] = { SECG_OID, 0x1f }; /* unsupported by freebl */
CONST_OID secgECsecp224k1[] = { SECG_OID, 0x20 }; /* unsupported by freebl */
CONST_OID secgECsecp224r1[] = { SECG_OID, 0x21 }; /* unsupported by freebl */
CONST_OID secgECsecp256k1[] = { SECG_OID, 0x0a }; /* unsupported by freebl */
CONST_OID secgECsecp384r1[] = { SECG_OID, 0x22 };
CONST_OID secgECsecp521r1[] = { SECG_OID, 0x23 };

/* ANSI X9.62 characteristic two curve OIDs */
CONST_OID ansiX962c2pnb163v1[] = { ANSI_X962_GF2m_OID, 0x01 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb163v2[] = { ANSI_X962_GF2m_OID, 0x02 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb163v3[] = { ANSI_X962_GF2m_OID, 0x03 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb176v1[] = { ANSI_X962_GF2m_OID, 0x04 }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb191v1[] = { ANSI_X962_GF2m_OID, 0x05 }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb191v2[] = { ANSI_X962_GF2m_OID, 0x06 }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb191v3[] = { ANSI_X962_GF2m_OID, 0x07 }; /* unsupported by freebl */
CONST_OID ansiX962c2onb191v4[] = { ANSI_X962_GF2m_OID, 0x08 }; /* unsupported by freebl */
CONST_OID ansiX962c2onb191v5[] = { ANSI_X962_GF2m_OID, 0x09 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb208w1[] = { ANSI_X962_GF2m_OID, 0x0a }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb239v1[] = { ANSI_X962_GF2m_OID, 0x0b }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb239v2[] = { ANSI_X962_GF2m_OID, 0x0c }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb239v3[] = { ANSI_X962_GF2m_OID, 0x0d }; /* unsupported by freebl */
CONST_OID ansiX962c2onb239v4[] = { ANSI_X962_GF2m_OID, 0x0e }; /* unsupported by freebl */
CONST_OID ansiX962c2onb239v5[] = { ANSI_X962_GF2m_OID, 0x0f }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb272w1[] = { ANSI_X962_GF2m_OID, 0x10 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb304w1[] = { ANSI_X962_GF2m_OID, 0x11 }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb359v1[] = { ANSI_X962_GF2m_OID, 0x12 }; /* unsupported by freebl */
CONST_OID ansiX962c2pnb368w1[] = { ANSI_X962_GF2m_OID, 0x13 }; /* unsupported by freebl */
CONST_OID ansiX962c2tnb431r1[] = { ANSI_X962_GF2m_OID, 0x14 }; /* unsupported by freebl */

/* SECG characterisitic two curve OIDs */
CONST_OID secgECsect113r1[] = { SECG_OID, 0x04 }; /* unsupported by freebl */
CONST_OID secgECsect113r2[] = { SECG_OID, 0x05 }; /* unsupported by freebl */
CONST_OID secgECsect131r1[] = { SECG_OID, 0x16 }; /* unsupported by freebl */
CONST_OID secgECsect131r2[] = { SECG_OID, 0x17 }; /* unsupported by freebl */
CONST_OID secgECsect163k1[] = { SECG_OID, 0x01 }; /* unsupported by freebl */
CONST_OID secgECsect163r1[] = { SECG_OID, 0x02 }; /* unsupported by freebl */
CONST_OID secgECsect163r2[] = { SECG_OID, 0x0f }; /* unsupported by freebl */
CONST_OID secgECsect193r1[] = { SECG_OID, 0x18 }; /* unsupported by freebl */
CONST_OID secgECsect193r2[] = { SECG_OID, 0x19 }; /* unsupported by freebl */
CONST_OID secgECsect233k1[] = { SECG_OID, 0x1a }; /* unsupported by freebl */
CONST_OID secgECsect233r1[] = { SECG_OID, 0x1b }; /* unsupported by freebl */
CONST_OID secgECsect239k1[] = { SECG_OID, 0x03 }; /* unsupported by freebl */
CONST_OID secgECsect283k1[] = { SECG_OID, 0x10 }; /* unsupported by freebl */
CONST_OID secgECsect283r1[] = { SECG_OID, 0x11 }; /* unsupported by freebl */
CONST_OID secgECsect409k1[] = { SECG_OID, 0x24 }; /* unsupported by freebl */
CONST_OID secgECsect409r1[] = { SECG_OID, 0x25 }; /* unsupported by freebl */
CONST_OID secgECsect571k1[] = { SECG_OID, 0x26 }; /* unsupported by freebl */
CONST_OID secgECsect571r1[] = { SECG_OID, 0x27 }; /* unsupported by freebl */

CONST_OID seed_CBC[] = { SEED_OID, 4 };

CONST_OID evIncorporationLocality[] = { EV_NAME_ATTRIBUTE, 1 };
CONST_OID evIncorporationState[] = { EV_NAME_ATTRIBUTE, 2 };
CONST_OID evIncorporationCountry[] = { EV_NAME_ATTRIBUTE, 3 };

/* https://tools.ietf.org/html/draft-josefsson-pkix-newcurves-01
 * 1.3.6.1.4.1.11591.15.1
 */
CONST_OID curve25519[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0xDA, 0x47, 0x0F, 0x01 };

#define OI(x)                                  \
    {                                          \
        siDEROID, (unsigned char *)x, sizeof x \
    }
#ifndef SECOID_NO_STRINGS
#define OD(oid, tag, desc, mech, ext) \
    {                                 \
        OI(oid)                       \
        , tag, desc, mech, ext        \
    }
#define ODE(tag, desc, mech, ext)                   \
    {                                               \
        { siDEROID, NULL, 0 }, tag, desc, mech, ext \
    }
#else
#define OD(oid, tag, desc, mech, ext) \
    {                                 \
        OI(oid)                       \
        , tag, 0, mech, ext           \
    }
#define ODE(tag, desc, mech, ext)                \
    {                                            \
        { siDEROID, NULL, 0 }, tag, 0, mech, ext \
    }
#endif

#if defined(NSS_ALLOW_UNSUPPORTED_CRITICAL)
#define FAKE_SUPPORTED_CERT_EXTENSION SUPPORTED_CERT_EXTENSION
#else
#define FAKE_SUPPORTED_CERT_EXTENSION UNSUPPORTED_CERT_EXTENSION
#endif

/*
 * NOTE: the order of these entries must mach the SECOidTag enum in secoidt.h!
 */
const static SECOidData oids[SEC_OID_TOTAL] = {
    { { siDEROID, NULL, 0 }, SEC_OID_UNKNOWN, "Unknown OID", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION },
    OD(md2, SEC_OID_MD2, "MD2", CKM_MD2, INVALID_CERT_EXTENSION),
    OD(md4, SEC_OID_MD4,
       "MD4", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(md5, SEC_OID_MD5, "MD5", CKM_MD5, INVALID_CERT_EXTENSION),
    OD(sha1, SEC_OID_SHA1, "SHA-1", CKM_SHA_1, INVALID_CERT_EXTENSION),
    OD(rc2cbc, SEC_OID_RC2_CBC,
       "RC2-CBC", CKM_RC2_CBC, INVALID_CERT_EXTENSION),
    OD(rc4, SEC_OID_RC4, "RC4", CKM_RC4, INVALID_CERT_EXTENSION),
    OD(desede3cbc, SEC_OID_DES_EDE3_CBC,
       "DES-EDE3-CBC", CKM_DES3_CBC, INVALID_CERT_EXTENSION),
    OD(rc5cbcpad, SEC_OID_RC5_CBC_PAD,
       "RC5-CBCPad", CKM_RC5_CBC, INVALID_CERT_EXTENSION),
    OD(desecb, SEC_OID_DES_ECB,
       "DES-ECB", CKM_DES_ECB, INVALID_CERT_EXTENSION),
    OD(descbc, SEC_OID_DES_CBC,
       "DES-CBC", CKM_DES_CBC, INVALID_CERT_EXTENSION),
    OD(desofb, SEC_OID_DES_OFB,
       "DES-OFB", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(descfb, SEC_OID_DES_CFB,
       "DES-CFB", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(desmac, SEC_OID_DES_MAC,
       "DES-MAC", CKM_DES_MAC, INVALID_CERT_EXTENSION),
    OD(desede, SEC_OID_DES_EDE,
       "DES-EDE", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(isoSHAWithRSASignature, SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE,
       "ISO SHA with RSA Signature",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs1RSAEncryption, SEC_OID_PKCS1_RSA_ENCRYPTION,
       "PKCS #1 RSA Encryption", CKM_RSA_PKCS, INVALID_CERT_EXTENSION),

    /* the following Signing mechanisms should get new CKM_ values when
     * values for CKM_RSA_WITH_MDX and CKM_RSA_WITH_SHA_1 get defined in
     * PKCS #11.
     */
    OD(pkcs1MD2WithRSAEncryption, SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION,
       "PKCS #1 MD2 With RSA Encryption", CKM_MD2_RSA_PKCS,
       INVALID_CERT_EXTENSION),
    OD(pkcs1MD4WithRSAEncryption, SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION,
       "PKCS #1 MD4 With RSA Encryption",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs1MD5WithRSAEncryption, SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION,
       "PKCS #1 MD5 With RSA Encryption", CKM_MD5_RSA_PKCS,
       INVALID_CERT_EXTENSION),
    OD(pkcs1SHA1WithRSAEncryption, SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION,
       "PKCS #1 SHA-1 With RSA Encryption", CKM_SHA1_RSA_PKCS,
       INVALID_CERT_EXTENSION),

    OD(pkcs5PbeWithMD2AndDEScbc, SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC,
       "PKCS #5 Password Based Encryption with MD2 and DES-CBC",
       CKM_PBE_MD2_DES_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs5PbeWithMD5AndDEScbc, SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC,
       "PKCS #5 Password Based Encryption with MD5 and DES-CBC",
       CKM_PBE_MD5_DES_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs5PbeWithSha1AndDEScbc, SEC_OID_PKCS5_PBE_WITH_SHA1_AND_DES_CBC,
       "PKCS #5 Password Based Encryption with SHA-1 and DES-CBC",
       CKM_NSS_PBE_SHA1_DES_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs7, SEC_OID_PKCS7,
       "PKCS #7", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7Data, SEC_OID_PKCS7_DATA,
       "PKCS #7 Data", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7SignedData, SEC_OID_PKCS7_SIGNED_DATA,
       "PKCS #7 Signed Data", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7EnvelopedData, SEC_OID_PKCS7_ENVELOPED_DATA,
       "PKCS #7 Enveloped Data",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7SignedEnvelopedData, SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA,
       "PKCS #7 Signed And Enveloped Data",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7DigestedData, SEC_OID_PKCS7_DIGESTED_DATA,
       "PKCS #7 Digested Data",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs7EncryptedData, SEC_OID_PKCS7_ENCRYPTED_DATA,
       "PKCS #7 Encrypted Data",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9EmailAddress, SEC_OID_PKCS9_EMAIL_ADDRESS,
       "PKCS #9 Email Address",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9UnstructuredName, SEC_OID_PKCS9_UNSTRUCTURED_NAME,
       "PKCS #9 Unstructured Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9ContentType, SEC_OID_PKCS9_CONTENT_TYPE,
       "PKCS #9 Content Type",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9MessageDigest, SEC_OID_PKCS9_MESSAGE_DIGEST,
       "PKCS #9 Message Digest",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9SigningTime, SEC_OID_PKCS9_SIGNING_TIME,
       "PKCS #9 Signing Time",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9CounterSignature, SEC_OID_PKCS9_COUNTER_SIGNATURE,
       "PKCS #9 Counter Signature",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9ChallengePassword, SEC_OID_PKCS9_CHALLENGE_PASSWORD,
       "PKCS #9 Challenge Password",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9UnstructuredAddress, SEC_OID_PKCS9_UNSTRUCTURED_ADDRESS,
       "PKCS #9 Unstructured Address",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9ExtendedCertificateAttributes,
       SEC_OID_PKCS9_EXTENDED_CERTIFICATE_ATTRIBUTES,
       "PKCS #9 Extended Certificate Attributes",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9SMIMECapabilities, SEC_OID_PKCS9_SMIME_CAPABILITIES,
       "PKCS #9 S/MIME Capabilities",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520CommonName, SEC_OID_AVA_COMMON_NAME,
       "X520 Common Name", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520CountryName, SEC_OID_AVA_COUNTRY_NAME,
       "X520 Country Name", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520LocalityName, SEC_OID_AVA_LOCALITY,
       "X520 Locality Name", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520StateOrProvinceName, SEC_OID_AVA_STATE_OR_PROVINCE,
       "X520 State Or Province Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520OrgName, SEC_OID_AVA_ORGANIZATION_NAME,
       "X520 Organization Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520OrgUnitName, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME,
       "X520 Organizational Unit Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520DnQualifier, SEC_OID_AVA_DN_QUALIFIER,
       "X520 DN Qualifier", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(rfc2247DomainComponent, SEC_OID_AVA_DC,
       "RFC 2247 Domain Component",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(nsTypeGIF, SEC_OID_NS_TYPE_GIF,
       "GIF", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(nsTypeJPEG, SEC_OID_NS_TYPE_JPEG,
       "JPEG", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(nsTypeURL, SEC_OID_NS_TYPE_URL,
       "URL", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(nsTypeHTML, SEC_OID_NS_TYPE_HTML,
       "HTML", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(nsTypeCertSeq, SEC_OID_NS_TYPE_CERT_SEQUENCE,
       "Certificate Sequence",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertKEADSSOld, SEC_OID_MISSI_KEA_DSS_OLD,
       "MISSI KEA and DSS Algorithm (Old)",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertDSSOld, SEC_OID_MISSI_DSS_OLD,
       "MISSI DSS Algorithm (Old)",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertKEADSS, SEC_OID_MISSI_KEA_DSS,
       "MISSI KEA and DSS Algorithm",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertDSS, SEC_OID_MISSI_DSS,
       "MISSI DSS Algorithm",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertKEA, SEC_OID_MISSI_KEA,
       "MISSI KEA Algorithm",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(missiCertAltKEA, SEC_OID_MISSI_ALT_KEA,
       "MISSI Alternate KEA Algorithm",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* Netscape private extensions */
    OD(nsCertExtNetscapeOK, SEC_OID_NS_CERT_EXT_NETSCAPE_OK,
       "Netscape says this cert is OK",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsCertExtIssuerLogo, SEC_OID_NS_CERT_EXT_ISSUER_LOGO,
       "Certificate Issuer Logo",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsCertExtSubjectLogo, SEC_OID_NS_CERT_EXT_SUBJECT_LOGO,
       "Certificate Subject Logo",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtCertType, SEC_OID_NS_CERT_EXT_CERT_TYPE,
       "Certificate Type",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtBaseURL, SEC_OID_NS_CERT_EXT_BASE_URL,
       "Certificate Extension Base URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtRevocationURL, SEC_OID_NS_CERT_EXT_REVOCATION_URL,
       "Certificate Revocation URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtCARevocationURL, SEC_OID_NS_CERT_EXT_CA_REVOCATION_URL,
       "Certificate Authority Revocation URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtCACRLURL, SEC_OID_NS_CERT_EXT_CA_CRL_URL,
       "Certificate Authority CRL Download URL",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtCACertURL, SEC_OID_NS_CERT_EXT_CA_CERT_URL,
       "Certificate Authority Certificate Download URL",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtCertRenewalURL, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_URL,
       "Certificate Renewal URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtCAPolicyURL, SEC_OID_NS_CERT_EXT_CA_POLICY_URL,
       "Certificate Authority Policy URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtHomepageURL, SEC_OID_NS_CERT_EXT_HOMEPAGE_URL,
       "Certificate Homepage URL",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtEntityLogo, SEC_OID_NS_CERT_EXT_ENTITY_LOGO,
       "Certificate Entity Logo",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtUserPicture, SEC_OID_NS_CERT_EXT_USER_PICTURE,
       "Certificate User Picture",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtSSLServerName, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME,
       "Certificate SSL Server Name",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(nsExtComment, SEC_OID_NS_CERT_EXT_COMMENT,
       "Certificate Comment",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtLostPasswordURL, SEC_OID_NS_CERT_EXT_LOST_PASSWORD_URL,
       "Lost Password URL",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsExtCertRenewalTime, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_TIME,
       "Certificate Renewal Time",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(nsKeyUsageGovtApproved, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED,
       "Strong Crypto Export Approved",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),

    /* x.509 v3 certificate extensions */
    OD(x509SubjectDirectoryAttr, SEC_OID_X509_SUBJECT_DIRECTORY_ATTR,
       "Certificate Subject Directory Attributes",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(x509SubjectKeyID, SEC_OID_X509_SUBJECT_KEY_ID,
       "Certificate Subject Key ID",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509KeyUsage, SEC_OID_X509_KEY_USAGE,
       "Certificate Key Usage",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509PrivateKeyUsagePeriod, SEC_OID_X509_PRIVATE_KEY_USAGE_PERIOD,
       "Certificate Private Key Usage Period",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(x509SubjectAltName, SEC_OID_X509_SUBJECT_ALT_NAME,
       "Certificate Subject Alt Name",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509IssuerAltName, SEC_OID_X509_ISSUER_ALT_NAME,
       "Certificate Issuer Alt Name",
       CKM_INVALID_MECHANISM, FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509BasicConstraints, SEC_OID_X509_BASIC_CONSTRAINTS,
       "Certificate Basic Constraints",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509NameConstraints, SEC_OID_X509_NAME_CONSTRAINTS,
       "Certificate Name Constraints",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509CRLDistPoints, SEC_OID_X509_CRL_DIST_POINTS,
       "CRL Distribution Points",
       CKM_INVALID_MECHANISM, FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509CertificatePolicies, SEC_OID_X509_CERTIFICATE_POLICIES,
       "Certificate Policies",
       CKM_INVALID_MECHANISM, FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509PolicyMappings, SEC_OID_X509_POLICY_MAPPINGS,
       "Certificate Policy Mappings",
       CKM_INVALID_MECHANISM, UNSUPPORTED_CERT_EXTENSION),
    OD(x509PolicyConstraints, SEC_OID_X509_POLICY_CONSTRAINTS,
       "Certificate Policy Constraints",
       CKM_INVALID_MECHANISM, FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509AuthKeyID, SEC_OID_X509_AUTH_KEY_ID,
       "Certificate Authority Key Identifier",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509ExtKeyUsage, SEC_OID_X509_EXT_KEY_USAGE,
       "Extended Key Usage",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509AuthInfoAccess, SEC_OID_X509_AUTH_INFO_ACCESS,
       "Authority Information Access",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),

    /* x.509 v3 CRL extensions */
    OD(x509CRLNumber, SEC_OID_X509_CRL_NUMBER,
       "CRL Number", CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509ReasonCode, SEC_OID_X509_REASON_CODE,
       "CRL reason code", CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(x509InvalidDate, SEC_OID_X509_INVALID_DATE,
       "Invalid Date", CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),

    OD(x500RSAEncryption, SEC_OID_X500_RSA_ENCRYPTION,
       "X500 RSA Encryption", CKM_RSA_X_509, INVALID_CERT_EXTENSION),

    /* added for alg 1485 */
    OD(rfc1274Uid, SEC_OID_RFC1274_UID,
       "RFC1274 User Id", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(rfc1274Mail, SEC_OID_RFC1274_MAIL,
       "RFC1274 E-mail Address",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* pkcs 12 additions */
    OD(pkcs12, SEC_OID_PKCS12,
       "PKCS #12", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12ModeIDs, SEC_OID_PKCS12_MODE_IDS,
       "PKCS #12 Mode IDs", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12ESPVKIDs, SEC_OID_PKCS12_ESPVK_IDS,
       "PKCS #12 ESPVK IDs", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12BagIDs, SEC_OID_PKCS12_BAG_IDS,
       "PKCS #12 Bag IDs", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12CertBagIDs, SEC_OID_PKCS12_CERT_BAG_IDS,
       "PKCS #12 Cert Bag IDs",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12OIDs, SEC_OID_PKCS12_OIDS,
       "PKCS #12 OIDs", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEIDs, SEC_OID_PKCS12_PBE_IDS,
       "PKCS #12 PBE IDs", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12SignatureIDs, SEC_OID_PKCS12_SIGNATURE_IDS,
       "PKCS #12 Signature IDs",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12EnvelopingIDs, SEC_OID_PKCS12_ENVELOPING_IDS,
       "PKCS #12 Enveloping IDs",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12PKCS8KeyShrouding, SEC_OID_PKCS12_PKCS8_KEY_SHROUDING,
       "PKCS #12 Key Shrouding",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12KeyBagID, SEC_OID_PKCS12_KEY_BAG_ID,
       "PKCS #12 Key Bag ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12CertAndCRLBagID, SEC_OID_PKCS12_CERT_AND_CRL_BAG_ID,
       "PKCS #12 Cert And CRL Bag ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12SecretBagID, SEC_OID_PKCS12_SECRET_BAG_ID,
       "PKCS #12 Secret Bag ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12X509CertCRLBag, SEC_OID_PKCS12_X509_CERT_CRL_BAG,
       "PKCS #12 X509 Cert CRL Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12SDSICertBag, SEC_OID_PKCS12_SDSI_CERT_BAG,
       "PKCS #12 SDSI Cert Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEWithSha1And128BitRC4,
       SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC4,
       "PKCS #12 PBE With SHA-1 and 128 Bit RC4",
       CKM_NSS_PBE_SHA1_128_BIT_RC4, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEWithSha1And40BitRC4,
       SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC4,
       "PKCS #12 PBE With SHA-1 and 40 Bit RC4",
       CKM_NSS_PBE_SHA1_40_BIT_RC4, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEWithSha1AndTripleDESCBC,
       SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC,
       "PKCS #12 PBE With SHA-1 and Triple DES-CBC",
       CKM_NSS_PBE_SHA1_TRIPLE_DES_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEWithSha1And128BitRC2CBC,
       SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC,
       "PKCS #12 PBE With SHA-1 and 128 Bit RC2 CBC",
       CKM_NSS_PBE_SHA1_128_BIT_RC2_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12PBEWithSha1And40BitRC2CBC,
       SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC,
       "PKCS #12 PBE With SHA-1 and 40 Bit RC2 CBC",
       CKM_NSS_PBE_SHA1_40_BIT_RC2_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12RSAEncryptionWith128BitRC4,
       SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_128_BIT_RC4,
       "PKCS #12 RSA Encryption with 128 Bit RC4",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12RSAEncryptionWith40BitRC4,
       SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_40_BIT_RC4,
       "PKCS #12 RSA Encryption with 40 Bit RC4",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12RSAEncryptionWithTripleDES,
       SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_TRIPLE_DES,
       "PKCS #12 RSA Encryption with Triple DES",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12RSASignatureWithSHA1Digest,
       SEC_OID_PKCS12_RSA_SIGNATURE_WITH_SHA1_DIGEST,
       "PKCS #12 RSA Encryption with Triple DES",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* DSA signatures */
    OD(ansix9DSASignature, SEC_OID_ANSIX9_DSA_SIGNATURE,
       "ANSI X9.57 DSA Signature", CKM_DSA, INVALID_CERT_EXTENSION),
    OD(ansix9DSASignaturewithSHA1Digest,
       SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST,
       "ANSI X9.57 DSA Signature with SHA-1 Digest",
       CKM_DSA_SHA1, INVALID_CERT_EXTENSION),
    OD(bogusDSASignaturewithSHA1Digest,
       SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST,
       "FORTEZZA DSA Signature with SHA-1 Digest",
       CKM_DSA_SHA1, INVALID_CERT_EXTENSION),

    /* verisign oids */
    OD(verisignUserNotices, SEC_OID_VERISIGN_USER_NOTICES,
       "Verisign User Notices",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* pkix oids */
    OD(pkixCPSPointerQualifier, SEC_OID_PKIX_CPS_POINTER_QUALIFIER,
       "PKIX CPS Pointer Qualifier",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixUserNoticeQualifier, SEC_OID_PKIX_USER_NOTICE_QUALIFIER,
       "PKIX User Notice Qualifier",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(pkixOCSP, SEC_OID_PKIX_OCSP,
       "PKIX Online Certificate Status Protocol",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPBasicResponse, SEC_OID_PKIX_OCSP_BASIC_RESPONSE,
       "OCSP Basic Response", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPNonce, SEC_OID_PKIX_OCSP_NONCE,
       "OCSP Nonce Extension", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPCRL, SEC_OID_PKIX_OCSP_CRL,
       "OCSP CRL Reference Extension",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPResponse, SEC_OID_PKIX_OCSP_RESPONSE,
       "OCSP Response Types Extension",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPNoCheck, SEC_OID_PKIX_OCSP_NO_CHECK,
       "OCSP No Check Extension",
       CKM_INVALID_MECHANISM, SUPPORTED_CERT_EXTENSION),
    OD(pkixOCSPArchiveCutoff, SEC_OID_PKIX_OCSP_ARCHIVE_CUTOFF,
       "OCSP Archive Cutoff Extension",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPServiceLocator, SEC_OID_PKIX_OCSP_SERVICE_LOCATOR,
       "OCSP Service Locator Extension",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(pkixRegCtrlRegToken, SEC_OID_PKIX_REGCTRL_REGTOKEN,
       "PKIX CRMF Registration Control, Registration Token",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegCtrlAuthenticator, SEC_OID_PKIX_REGCTRL_AUTHENTICATOR,
       "PKIX CRMF Registration Control, Registration Authenticator",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegCtrlPKIPubInfo, SEC_OID_PKIX_REGCTRL_PKIPUBINFO,
       "PKIX CRMF Registration Control, PKI Publication Info",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegCtrlPKIArchOptions,
       SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS,
       "PKIX CRMF Registration Control, PKI Archive Options",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegCtrlOldCertID, SEC_OID_PKIX_REGCTRL_OLD_CERT_ID,
       "PKIX CRMF Registration Control, Old Certificate ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegCtrlProtEncKey, SEC_OID_PKIX_REGCTRL_PROTOCOL_ENC_KEY,
       "PKIX CRMF Registration Control, Protocol Encryption Key",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegInfoUTF8Pairs, SEC_OID_PKIX_REGINFO_UTF8_PAIRS,
       "PKIX CRMF Registration Info, UTF8 Pairs",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixRegInfoCertReq, SEC_OID_PKIX_REGINFO_CERT_REQUEST,
       "PKIX CRMF Registration Info, Certificate Request",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageServerAuth,
       SEC_OID_EXT_KEY_USAGE_SERVER_AUTH,
       "TLS Web Server Authentication Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageClientAuth,
       SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH,
       "TLS Web Client Authentication Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageCodeSign, SEC_OID_EXT_KEY_USAGE_CODE_SIGN,
       "Code Signing Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageEMailProtect,
       SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT,
       "E-Mail Protection Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageTimeStamp,
       SEC_OID_EXT_KEY_USAGE_TIME_STAMP,
       "Time Stamping Certifcate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixOCSPResponderExtendedKeyUsage, SEC_OID_OCSP_RESPONDER,
       "OCSP Responder Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* Netscape Algorithm OIDs */

    OD(netscapeSMimeKEA, SEC_OID_NETSCAPE_SMIME_KEA,
       "Netscape S/MIME KEA", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* Skipjack OID -- ### mwelch temporary */
    OD(skipjackCBC, SEC_OID_FORTEZZA_SKIPJACK,
       "Skipjack CBC64", CKM_SKIPJACK_CBC64, INVALID_CERT_EXTENSION),

    /* pkcs12 v2 oids */
    OD(pkcs12V2PBEWithSha1And128BitRC4,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC4,
       "PKCS #12 V2 PBE With SHA-1 And 128 Bit RC4",
       CKM_PBE_SHA1_RC4_128, INVALID_CERT_EXTENSION),
    OD(pkcs12V2PBEWithSha1And40BitRC4,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC4,
       "PKCS #12 V2 PBE With SHA-1 And 40 Bit RC4",
       CKM_PBE_SHA1_RC4_40, INVALID_CERT_EXTENSION),
    OD(pkcs12V2PBEWithSha1And3KeyTripleDEScbc,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC,
       "PKCS #12 V2 PBE With SHA-1 And 3KEY Triple DES-CBC",
       CKM_PBE_SHA1_DES3_EDE_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12V2PBEWithSha1And2KeyTripleDEScbc,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_2KEY_TRIPLE_DES_CBC,
       "PKCS #12 V2 PBE With SHA-1 And 2KEY Triple DES-CBC",
       CKM_PBE_SHA1_DES2_EDE_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12V2PBEWithSha1And128BitRC2cbc,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC,
       "PKCS #12 V2 PBE With SHA-1 And 128 Bit RC2 CBC",
       CKM_PBE_SHA1_RC2_128_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12V2PBEWithSha1And40BitRC2cbc,
       SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC,
       "PKCS #12 V2 PBE With SHA-1 And 40 Bit RC2 CBC",
       CKM_PBE_SHA1_RC2_40_CBC, INVALID_CERT_EXTENSION),
    OD(pkcs12SafeContentsID, SEC_OID_PKCS12_SAFE_CONTENTS_ID,
       "PKCS #12 Safe Contents ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12PKCS8ShroudedKeyBagID,
       SEC_OID_PKCS12_PKCS8_SHROUDED_KEY_BAG_ID,
       "PKCS #12 Safe Contents ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1KeyBag, SEC_OID_PKCS12_V1_KEY_BAG_ID,
       "PKCS #12 V1 Key Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1PKCS8ShroudedKeyBag,
       SEC_OID_PKCS12_V1_PKCS8_SHROUDED_KEY_BAG_ID,
       "PKCS #12 V1 PKCS8 Shrouded Key Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1CertBag, SEC_OID_PKCS12_V1_CERT_BAG_ID,
       "PKCS #12 V1 Cert Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1CRLBag, SEC_OID_PKCS12_V1_CRL_BAG_ID,
       "PKCS #12 V1 CRL Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1SecretBag, SEC_OID_PKCS12_V1_SECRET_BAG_ID,
       "PKCS #12 V1 Secret Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12V1SafeContentsBag, SEC_OID_PKCS12_V1_SAFE_CONTENTS_BAG_ID,
       "PKCS #12 V1 Safe Contents Bag",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(pkcs9X509Certificate, SEC_OID_PKCS9_X509_CERT,
       "PKCS #9 X509 Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9SDSICertificate, SEC_OID_PKCS9_SDSI_CERT,
       "PKCS #9 SDSI Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9X509CRL, SEC_OID_PKCS9_X509_CRL,
       "PKCS #9 X509 CRL", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9FriendlyName, SEC_OID_PKCS9_FRIENDLY_NAME,
       "PKCS #9 Friendly Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9LocalKeyID, SEC_OID_PKCS9_LOCAL_KEY_ID,
       "PKCS #9 Local Key ID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs12KeyUsageAttr, SEC_OID_BOGUS_KEY_USAGE,
       "Bogus Key Usage", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(dhPublicKey, SEC_OID_X942_DIFFIE_HELMAN_KEY,
       "Diffie-Helman Public Key", CKM_DH_PKCS_DERIVE,
       INVALID_CERT_EXTENSION),
    OD(netscapeNickname, SEC_OID_NETSCAPE_NICKNAME,
       "Netscape Nickname", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* Cert Server specific OIDs */
    OD(netscapeRecoveryRequest, SEC_OID_NETSCAPE_RECOVERY_REQUEST,
       "Recovery Request OID",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(nsExtAIACertRenewal, SEC_OID_CERT_RENEWAL_LOCATOR,
       "Certificate Renewal Locator OID", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    OD(nsExtCertScopeOfUse, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE,
       "Certificate Scope-of-Use Extension", CKM_INVALID_MECHANISM,
       SUPPORTED_CERT_EXTENSION),

    /* CMS stuff */
    OD(cmsESDH, SEC_OID_CMS_EPHEMERAL_STATIC_DIFFIE_HELLMAN,
       "Ephemeral-Static Diffie-Hellman", CKM_INVALID_MECHANISM /* XXX */,
       INVALID_CERT_EXTENSION),
    OD(cms3DESwrap, SEC_OID_CMS_3DES_KEY_WRAP,
       "CMS Triple DES Key Wrap", CKM_INVALID_MECHANISM /* XXX */,
       INVALID_CERT_EXTENSION),
    OD(cmsRC2wrap, SEC_OID_CMS_RC2_KEY_WRAP,
       "CMS RC2 Key Wrap", CKM_INVALID_MECHANISM /* XXX */,
       INVALID_CERT_EXTENSION),
    OD(smimeEncryptionKeyPreference, SEC_OID_SMIME_ENCRYPTION_KEY_PREFERENCE,
       "S/MIME Encryption Key Preference",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* AES algorithm OIDs */
    OD(aes128_ECB, SEC_OID_AES_128_ECB,
       "AES-128-ECB", CKM_AES_ECB, INVALID_CERT_EXTENSION),
    OD(aes128_CBC, SEC_OID_AES_128_CBC,
       "AES-128-CBC", CKM_AES_CBC, INVALID_CERT_EXTENSION),
    OD(aes192_ECB, SEC_OID_AES_192_ECB,
       "AES-192-ECB", CKM_AES_ECB, INVALID_CERT_EXTENSION),
    OD(aes192_CBC, SEC_OID_AES_192_CBC,
       "AES-192-CBC", CKM_AES_CBC, INVALID_CERT_EXTENSION),
    OD(aes256_ECB, SEC_OID_AES_256_ECB,
       "AES-256-ECB", CKM_AES_ECB, INVALID_CERT_EXTENSION),
    OD(aes256_CBC, SEC_OID_AES_256_CBC,
       "AES-256-CBC", CKM_AES_CBC, INVALID_CERT_EXTENSION),

    /* More bogus DSA OIDs */
    OD(sdn702DSASignature, SEC_OID_SDN702_DSA_SIGNATURE,
       "SDN.702 DSA Signature", CKM_DSA_SHA1, INVALID_CERT_EXTENSION),

    OD(ms_smimeEncryptionKeyPreference,
       SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE,
       "Microsoft S/MIME Encryption Key Preference",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(sha256, SEC_OID_SHA256, "SHA-256", CKM_SHA256, INVALID_CERT_EXTENSION),
    OD(sha384, SEC_OID_SHA384, "SHA-384", CKM_SHA384, INVALID_CERT_EXTENSION),
    OD(sha512, SEC_OID_SHA512, "SHA-512", CKM_SHA512, INVALID_CERT_EXTENSION),

    OD(pkcs1SHA256WithRSAEncryption, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION,
       "PKCS #1 SHA-256 With RSA Encryption", CKM_SHA256_RSA_PKCS,
       INVALID_CERT_EXTENSION),
    OD(pkcs1SHA384WithRSAEncryption, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION,
       "PKCS #1 SHA-384 With RSA Encryption", CKM_SHA384_RSA_PKCS,
       INVALID_CERT_EXTENSION),
    OD(pkcs1SHA512WithRSAEncryption, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION,
       "PKCS #1 SHA-512 With RSA Encryption", CKM_SHA512_RSA_PKCS,
       INVALID_CERT_EXTENSION),

    OD(aes128_KEY_WRAP, SEC_OID_AES_128_KEY_WRAP,
       "AES-128 Key Wrap", CKM_NSS_AES_KEY_WRAP, INVALID_CERT_EXTENSION),
    OD(aes192_KEY_WRAP, SEC_OID_AES_192_KEY_WRAP,
       "AES-192 Key Wrap", CKM_NSS_AES_KEY_WRAP, INVALID_CERT_EXTENSION),
    OD(aes256_KEY_WRAP, SEC_OID_AES_256_KEY_WRAP,
       "AES-256 Key Wrap", CKM_NSS_AES_KEY_WRAP, INVALID_CERT_EXTENSION),

    /* Elliptic Curve Cryptography (ECC) OIDs */
    OD(ansix962ECPublicKey, SEC_OID_ANSIX962_EC_PUBLIC_KEY,
       "X9.62 elliptic curve public key", CKM_ECDH1_DERIVE,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignaturewithSHA1Digest,
       SEC_OID_ANSIX962_ECDSA_SHA1_SIGNATURE,
       "X9.62 ECDSA signature with SHA-1", CKM_ECDSA_SHA1,
       INVALID_CERT_EXTENSION),

    /* Named curves */
    /* NOTE: Only P256, P384, P521, and 25519 are supported by softoken.
     *       Using other curves requires an appropriate token. */

    /* ANSI X9.62 named elliptic curves (prime field) */
    OD(ansiX962prime192v1, SEC_OID_ANSIX962_EC_PRIME192V1,
       "ANSI X9.62 elliptic curve prime192v1 (aka secp192r1, NIST P-192)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime192v2, SEC_OID_ANSIX962_EC_PRIME192V2,
       "ANSI X9.62 elliptic curve prime192v2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime192v3, SEC_OID_ANSIX962_EC_PRIME192V3,
       "ANSI X9.62 elliptic curve prime192v3",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime239v1, SEC_OID_ANSIX962_EC_PRIME239V1,
       "ANSI X9.62 elliptic curve prime239v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime239v2, SEC_OID_ANSIX962_EC_PRIME239V2,
       "ANSI X9.62 elliptic curve prime239v2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime239v3, SEC_OID_ANSIX962_EC_PRIME239V3,
       "ANSI X9.62 elliptic curve prime239v3",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962prime256v1, SEC_OID_ANSIX962_EC_PRIME256V1,
       "ANSI X9.62 elliptic curve prime256v1 (aka secp256r1, NIST P-256)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    /* SECG named elliptic curves (prime field) */
    OD(secgECsecp112r1, SEC_OID_SECG_EC_SECP112R1,
       "SECG elliptic curve secp112r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp112r2, SEC_OID_SECG_EC_SECP112R2,
       "SECG elliptic curve secp112r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp128r1, SEC_OID_SECG_EC_SECP128R1,
       "SECG elliptic curve secp128r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp128r2, SEC_OID_SECG_EC_SECP128R2,
       "SECG elliptic curve secp128r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp160k1, SEC_OID_SECG_EC_SECP160K1,
       "SECG elliptic curve secp160k1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp160r1, SEC_OID_SECG_EC_SECP160R1,
       "SECG elliptic curve secp160r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp160r2, SEC_OID_SECG_EC_SECP160R2,
       "SECG elliptic curve secp160r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp192k1, SEC_OID_SECG_EC_SECP192K1,
       "SECG elliptic curve secp192k1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp224k1, SEC_OID_SECG_EC_SECP224K1,
       "SECG elliptic curve secp224k1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp224r1, SEC_OID_SECG_EC_SECP224R1,
       "SECG elliptic curve secp224r1 (aka NIST P-224)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp256k1, SEC_OID_SECG_EC_SECP256K1,
       "SECG elliptic curve secp256k1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp384r1, SEC_OID_SECG_EC_SECP384R1,
       "SECG elliptic curve secp384r1 (aka NIST P-384)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsecp521r1, SEC_OID_SECG_EC_SECP521R1,
       "SECG elliptic curve secp521r1 (aka NIST P-521)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    /* ANSI X9.62 named elliptic curves (characteristic two field) */
    OD(ansiX962c2pnb163v1, SEC_OID_ANSIX962_EC_C2PNB163V1,
       "ANSI X9.62 elliptic curve c2pnb163v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb163v2, SEC_OID_ANSIX962_EC_C2PNB163V2,
       "ANSI X9.62 elliptic curve c2pnb163v2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb163v3, SEC_OID_ANSIX962_EC_C2PNB163V3,
       "ANSI X9.62 elliptic curve c2pnb163v3",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb176v1, SEC_OID_ANSIX962_EC_C2PNB176V1,
       "ANSI X9.62 elliptic curve c2pnb176v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb191v1, SEC_OID_ANSIX962_EC_C2TNB191V1,
       "ANSI X9.62 elliptic curve c2tnb191v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb191v2, SEC_OID_ANSIX962_EC_C2TNB191V2,
       "ANSI X9.62 elliptic curve c2tnb191v2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb191v3, SEC_OID_ANSIX962_EC_C2TNB191V3,
       "ANSI X9.62 elliptic curve c2tnb191v3",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2onb191v4, SEC_OID_ANSIX962_EC_C2ONB191V4,
       "ANSI X9.62 elliptic curve c2onb191v4",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2onb191v5, SEC_OID_ANSIX962_EC_C2ONB191V5,
       "ANSI X9.62 elliptic curve c2onb191v5",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb208w1, SEC_OID_ANSIX962_EC_C2PNB208W1,
       "ANSI X9.62 elliptic curve c2pnb208w1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb239v1, SEC_OID_ANSIX962_EC_C2TNB239V1,
       "ANSI X9.62 elliptic curve c2tnb239v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb239v2, SEC_OID_ANSIX962_EC_C2TNB239V2,
       "ANSI X9.62 elliptic curve c2tnb239v2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb239v3, SEC_OID_ANSIX962_EC_C2TNB239V3,
       "ANSI X9.62 elliptic curve c2tnb239v3",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2onb239v4, SEC_OID_ANSIX962_EC_C2ONB239V4,
       "ANSI X9.62 elliptic curve c2onb239v4",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2onb239v5, SEC_OID_ANSIX962_EC_C2ONB239V5,
       "ANSI X9.62 elliptic curve c2onb239v5",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb272w1, SEC_OID_ANSIX962_EC_C2PNB272W1,
       "ANSI X9.62 elliptic curve c2pnb272w1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb304w1, SEC_OID_ANSIX962_EC_C2PNB304W1,
       "ANSI X9.62 elliptic curve c2pnb304w1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb359v1, SEC_OID_ANSIX962_EC_C2TNB359V1,
       "ANSI X9.62 elliptic curve c2tnb359v1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2pnb368w1, SEC_OID_ANSIX962_EC_C2PNB368W1,
       "ANSI X9.62 elliptic curve c2pnb368w1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansiX962c2tnb431r1, SEC_OID_ANSIX962_EC_C2TNB431R1,
       "ANSI X9.62 elliptic curve c2tnb431r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    /* SECG named elliptic curves (characterisitic two field) */
    OD(secgECsect113r1, SEC_OID_SECG_EC_SECT113R1,
       "SECG elliptic curve sect113r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect113r2, SEC_OID_SECG_EC_SECT113R2,
       "SECG elliptic curve sect113r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect131r1, SEC_OID_SECG_EC_SECT131R1,
       "SECG elliptic curve sect131r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect131r2, SEC_OID_SECG_EC_SECT131R2,
       "SECG elliptic curve sect131r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect163k1, SEC_OID_SECG_EC_SECT163K1,
       "SECG elliptic curve sect163k1 (aka NIST K-163)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect163r1, SEC_OID_SECG_EC_SECT163R1,
       "SECG elliptic curve sect163r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect163r2, SEC_OID_SECG_EC_SECT163R2,
       "SECG elliptic curve sect163r2 (aka NIST B-163)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect193r1, SEC_OID_SECG_EC_SECT193R1,
       "SECG elliptic curve sect193r1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect193r2, SEC_OID_SECG_EC_SECT193R2,
       "SECG elliptic curve sect193r2",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect233k1, SEC_OID_SECG_EC_SECT233K1,
       "SECG elliptic curve sect233k1 (aka NIST K-233)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect233r1, SEC_OID_SECG_EC_SECT233R1,
       "SECG elliptic curve sect233r1 (aka NIST B-233)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect239k1, SEC_OID_SECG_EC_SECT239K1,
       "SECG elliptic curve sect239k1",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect283k1, SEC_OID_SECG_EC_SECT283K1,
       "SECG elliptic curve sect283k1 (aka NIST K-283)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect283r1, SEC_OID_SECG_EC_SECT283R1,
       "SECG elliptic curve sect283r1 (aka NIST B-283)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect409k1, SEC_OID_SECG_EC_SECT409K1,
       "SECG elliptic curve sect409k1 (aka NIST K-409)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect409r1, SEC_OID_SECG_EC_SECT409R1,
       "SECG elliptic curve sect409r1 (aka NIST B-409)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect571k1, SEC_OID_SECG_EC_SECT571K1,
       "SECG elliptic curve sect571k1 (aka NIST K-571)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(secgECsect571r1, SEC_OID_SECG_EC_SECT571R1,
       "SECG elliptic curve sect571r1 (aka NIST B-571)",
       CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    OD(netscapeAOLScreenname, SEC_OID_NETSCAPE_AOLSCREENNAME,
       "AOL Screenname", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    OD(x520SurName, SEC_OID_AVA_SURNAME,
       "X520 Title", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520SerialNumber, SEC_OID_AVA_SERIAL_NUMBER,
       "X520 Serial Number", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520StreetAddress, SEC_OID_AVA_STREET_ADDRESS,
       "X520 Street Address", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520Title, SEC_OID_AVA_TITLE,
       "X520 Title", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520PostalAddress, SEC_OID_AVA_POSTAL_ADDRESS,
       "X520 Postal Address", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520PostalCode, SEC_OID_AVA_POSTAL_CODE,
       "X520 Postal Code", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520PostOfficeBox, SEC_OID_AVA_POST_OFFICE_BOX,
       "X520 Post Office Box", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520GivenName, SEC_OID_AVA_GIVEN_NAME,
       "X520 Given Name", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520Initials, SEC_OID_AVA_INITIALS,
       "X520 Initials", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520GenerationQualifier, SEC_OID_AVA_GENERATION_QUALIFIER,
       "X520 Generation Qualifier",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520HouseIdentifier, SEC_OID_AVA_HOUSE_IDENTIFIER,
       "X520 House Identifier",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520Pseudonym, SEC_OID_AVA_PSEUDONYM,
       "X520 Pseudonym", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* More OIDs */
    OD(pkixCAIssuers, SEC_OID_PKIX_CA_ISSUERS,
       "PKIX CA issuers access method",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs9ExtensionRequest, SEC_OID_PKCS9_EXTENSION_REQUEST,
       "PKCS #9 Extension Request",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* more ECC Signature Oids */
    OD(ansix962SignatureRecommended,
       SEC_OID_ANSIX962_ECDSA_SIGNATURE_RECOMMENDED_DIGEST,
       "X9.62 ECDSA signature with recommended digest", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignatureSpecified,
       SEC_OID_ANSIX962_ECDSA_SIGNATURE_SPECIFIED_DIGEST,
       "X9.62 ECDSA signature with specified digest", CKM_ECDSA,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignaturewithSHA224Digest,
       SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE,
       "X9.62 ECDSA signature with SHA224", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignaturewithSHA256Digest,
       SEC_OID_ANSIX962_ECDSA_SHA256_SIGNATURE,
       "X9.62 ECDSA signature with SHA256", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignaturewithSHA384Digest,
       SEC_OID_ANSIX962_ECDSA_SHA384_SIGNATURE,
       "X9.62 ECDSA signature with SHA384", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(ansix962SignaturewithSHA512Digest,
       SEC_OID_ANSIX962_ECDSA_SHA512_SIGNATURE,
       "X9.62 ECDSA signature with SHA512", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    /* More id-ce and id-pe OIDs from RFC 3280 */
    OD(x509HoldInstructionCode, SEC_OID_X509_HOLD_INSTRUCTION_CODE,
       "CRL Hold Instruction Code", CKM_INVALID_MECHANISM,
       UNSUPPORTED_CERT_EXTENSION),
    OD(x509DeltaCRLIndicator, SEC_OID_X509_DELTA_CRL_INDICATOR,
       "Delta CRL Indicator", CKM_INVALID_MECHANISM,
       FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509IssuingDistributionPoint, SEC_OID_X509_ISSUING_DISTRIBUTION_POINT,
       "Issuing Distribution Point", CKM_INVALID_MECHANISM,
       FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509CertIssuer, SEC_OID_X509_CERT_ISSUER,
       "Certificate Issuer Extension", CKM_INVALID_MECHANISM,
       FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509FreshestCRL, SEC_OID_X509_FRESHEST_CRL,
       "Freshest CRL", CKM_INVALID_MECHANISM,
       UNSUPPORTED_CERT_EXTENSION),
    OD(x509InhibitAnyPolicy, SEC_OID_X509_INHIBIT_ANY_POLICY,
       "Inhibit Any Policy", CKM_INVALID_MECHANISM,
       FAKE_SUPPORTED_CERT_EXTENSION),
    OD(x509SubjectInfoAccess, SEC_OID_X509_SUBJECT_INFO_ACCESS,
       "Subject Info Access", CKM_INVALID_MECHANISM,
       UNSUPPORTED_CERT_EXTENSION),

    /* Camellia algorithm OIDs */
    OD(camellia128_CBC, SEC_OID_CAMELLIA_128_CBC,
       "CAMELLIA-128-CBC", CKM_CAMELLIA_CBC, INVALID_CERT_EXTENSION),
    OD(camellia192_CBC, SEC_OID_CAMELLIA_192_CBC,
       "CAMELLIA-192-CBC", CKM_CAMELLIA_CBC, INVALID_CERT_EXTENSION),
    OD(camellia256_CBC, SEC_OID_CAMELLIA_256_CBC,
       "CAMELLIA-256-CBC", CKM_CAMELLIA_CBC, INVALID_CERT_EXTENSION),

    /* PKCS 5 v2 OIDS */
    OD(pkcs5Pbkdf2, SEC_OID_PKCS5_PBKDF2,
       "PKCS #5 Password Based Key Dervive Function v2 ",
       CKM_PKCS5_PBKD2, INVALID_CERT_EXTENSION),
    OD(pkcs5Pbes2, SEC_OID_PKCS5_PBES2,
       "PKCS #5 Password Based Encryption v2 ",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkcs5Pbmac1, SEC_OID_PKCS5_PBMAC1,
       "PKCS #5 Password Based Authentication v1 ",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(hmac_sha1, SEC_OID_HMAC_SHA1, "HMAC SHA-1",
       CKM_SHA_1_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha224, SEC_OID_HMAC_SHA224, "HMAC SHA-224",
       CKM_SHA224_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha256, SEC_OID_HMAC_SHA256, "HMAC SHA-256",
       CKM_SHA256_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha384, SEC_OID_HMAC_SHA384, "HMAC SHA-384",
       CKM_SHA384_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha512, SEC_OID_HMAC_SHA512, "HMAC SHA-512",
       CKM_SHA512_HMAC, INVALID_CERT_EXTENSION),

    /* SIA extension OIDs */
    OD(x509SIATimeStamping, SEC_OID_PKIX_TIMESTAMPING,
       "SIA Time Stamping", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),
    OD(x509SIACaRepository, SEC_OID_PKIX_CA_REPOSITORY,
       "SIA CA Repository", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    OD(isoSHA1WithRSASignature, SEC_OID_ISO_SHA1_WITH_RSA_SIGNATURE,
       "ISO SHA-1 with RSA Signature",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    /* SEED algorithm OIDs */
    OD(seed_CBC, SEC_OID_SEED_CBC,
       "SEED-CBC", CKM_SEED_CBC, INVALID_CERT_EXTENSION),

    OD(x509CertificatePoliciesAnyPolicy, SEC_OID_X509_ANY_POLICY,
       "Certificate Policies AnyPolicy",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(pkcs1RSAOAEPEncryption, SEC_OID_PKCS1_RSA_OAEP_ENCRYPTION,
       "PKCS #1 RSA-OAEP Encryption", CKM_RSA_PKCS_OAEP,
       INVALID_CERT_EXTENSION),

    OD(pkcs1MGF1, SEC_OID_PKCS1_MGF1,
       "PKCS #1 MGF1 Mask Generation Function", CKM_INVALID_MECHANISM,
       INVALID_CERT_EXTENSION),

    OD(pkcs1PSpecified, SEC_OID_PKCS1_PSPECIFIED,
       "PKCS #1 RSA-OAEP Explicitly Specified Encoding Parameters",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(pkcs1RSAPSSSignature, SEC_OID_PKCS1_RSA_PSS_SIGNATURE,
       "PKCS #1 RSA-PSS Signature", CKM_RSA_PKCS_PSS,
       INVALID_CERT_EXTENSION),

    OD(pkcs1SHA224WithRSAEncryption, SEC_OID_PKCS1_SHA224_WITH_RSA_ENCRYPTION,
       "PKCS #1 SHA-224 With RSA Encryption", CKM_SHA224_RSA_PKCS,
       INVALID_CERT_EXTENSION),

    OD(sha224, SEC_OID_SHA224, "SHA-224", CKM_SHA224, INVALID_CERT_EXTENSION),

    OD(evIncorporationLocality, SEC_OID_EV_INCORPORATION_LOCALITY,
       "Jurisdiction of Incorporation Locality Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(evIncorporationState, SEC_OID_EV_INCORPORATION_STATE,
       "Jurisdiction of Incorporation State Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(evIncorporationCountry, SEC_OID_EV_INCORPORATION_COUNTRY,
       "Jurisdiction of Incorporation Country Name",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520BusinessCategory, SEC_OID_BUSINESS_CATEGORY,
       "Business Category",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(nistDSASignaturewithSHA224Digest,
       SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA224_DIGEST,
       "DSA with SHA-224 Signature",
       CKM_INVALID_MECHANISM /* not yet defined */, INVALID_CERT_EXTENSION),
    OD(nistDSASignaturewithSHA256Digest,
       SEC_OID_NIST_DSA_SIGNATURE_WITH_SHA256_DIGEST,
       "DSA with SHA-256 Signature",
       CKM_INVALID_MECHANISM /* not yet defined */, INVALID_CERT_EXTENSION),
    OD(msExtendedKeyUsageTrustListSigning,
       SEC_OID_MS_EXT_KEY_USAGE_CTL_SIGNING,
       "Microsoft Trust List Signing",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(x520Name, SEC_OID_AVA_NAME,
       "X520 Name", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(aes128_GCM, SEC_OID_AES_128_GCM,
       "AES-128-GCM", CKM_AES_GCM, INVALID_CERT_EXTENSION),
    OD(aes192_GCM, SEC_OID_AES_192_GCM,
       "AES-192-GCM", CKM_AES_GCM, INVALID_CERT_EXTENSION),
    OD(aes256_GCM, SEC_OID_AES_256_GCM,
       "AES-256-GCM", CKM_AES_GCM, INVALID_CERT_EXTENSION),
    OD(idea_CBC, SEC_OID_IDEA_CBC,
       "IDEA_CBC", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    ODE(SEC_OID_RC2_40_CBC,
        "RC2-40-CBC", CKM_RC2_CBC, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_DES_40_CBC,
        "DES-40-CBC", CKM_RC2_CBC, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_RC4_40,
        "RC4-40", CKM_RC4, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_RC4_56,
        "RC4-56", CKM_RC4, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_NULL_CIPHER,
        "NULL cipher", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_HMAC_MD5,
        "HMAC-MD5", CKM_MD5_HMAC, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_RSA,
        "TLS RSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_RSA,
        "TLS DHE-RSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_DSS,
        "TLS DHE-DSS key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_RSA,
        "TLS DH-RSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_DSS,
        "TLS DH-DSS key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_ANON,
        "TLS DH-ANON key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_ECDHE_ECDSA,
        "TLS ECDHE-ECDSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_ECDHE_RSA,
        "TLS ECDHE-RSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_ECDH_ECDSA,
        "TLS ECDH-ECDSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_ECDH_RSA,
        "TLS ECDH-RSA key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_ECDH_ANON,
        "TLS ECDH-ANON key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_RSA_EXPORT,
        "TLS RSA-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_RSA_EXPORT,
        "TLS DHE-RSA-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_DSS_EXPORT,
        "TLS DHE-DSS-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_RSA_EXPORT,
        "TLS DH-RSA-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_DSS_EXPORT,
        "TLS DH-DSS-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DH_ANON_EXPORT,
        "TLS DH-ANON-EXPORT key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_APPLY_SSL_POLICY,
        "Apply SSL policy (pseudo-OID)", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_CHACHA20_POLY1305,
        "ChaCha20-Poly1305", CKM_NSS_CHACHA20_POLY1305, INVALID_CERT_EXTENSION),

    ODE(SEC_OID_TLS_ECDHE_PSK,
        "TLS ECHDE-PSK key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_PSK,
        "TLS DHE-PSK key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    ODE(SEC_OID_TLS_FFDHE_2048,
        "TLS FFDHE 2048-bit key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_FFDHE_3072,
        "TLS FFDHE 3072-bit key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_FFDHE_4096,
        "TLS FFDHE 4096-bit key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_FFDHE_6144,
        "TLS FFDHE 6144-bit key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_FFDHE_8192,
        "TLS FFDHE 8192-bit key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS_DHE_CUSTOM,
        "TLS DHE custom group key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(curve25519, SEC_OID_CURVE25519,
       "Curve25519", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    ODE(SEC_OID_TLS13_KEA_ANY,
        "TLS 1.3 fake key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(x509ExtKeyUsageAnyUsage, SEC_OID_X509_ANY_EXT_KEY_USAGE,
       "Any Extended Key Usage",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageIPsecIKE,
       SEC_OID_EXT_KEY_USAGE_IPSEC_IKE,
       "IPsec IKE Certificate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(ipsecIKEEnd,
       SEC_OID_IPSEC_IKE_END,
       "IPsec IKE End",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(ipsecIKEIntermediate,
       SEC_OID_IPSEC_IKE_INTERMEDIATE,
       "IPsec IKE Intermediate",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageIPsecEnd,
       SEC_OID_EXT_KEY_USAGE_IPSEC_END,
       "IPsec Tunnel",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageIPsecTunnel,
       SEC_OID_EXT_KEY_USAGE_IPSEC_TUNNEL,
       "IPsec Tunnel",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
    OD(pkixExtendedKeyUsageIPsecUser,
       SEC_OID_EXT_KEY_USAGE_IPSEC_USER,
       "IPsec User",
       CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),

    OD(sha3_224, SEC_OID_SHA3_224, "SHA3-224", CKM_SHA3_224, INVALID_CERT_EXTENSION),
    OD(sha3_256, SEC_OID_SHA3_256, "SHA3-256", CKM_SHA3_256, INVALID_CERT_EXTENSION),
    OD(sha3_384, SEC_OID_SHA3_384, "SHA3-384", CKM_SHA3_384, INVALID_CERT_EXTENSION),
    OD(sha3_512, SEC_OID_SHA3_512, "SHA3-512", CKM_SHA3_512, INVALID_CERT_EXTENSION),

    OD(hmac_sha3_224, SEC_OID_HMAC_SHA3_224, "HMAC SHA3-224", CKM_SHA3_224_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha3_256, SEC_OID_HMAC_SHA3_256, "HMAC SHA3-256", CKM_SHA3_256_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha3_384, SEC_OID_HMAC_SHA3_384, "HMAC SHA3-384", CKM_SHA3_384_HMAC, INVALID_CERT_EXTENSION),
    OD(hmac_sha3_512, SEC_OID_HMAC_SHA3_512, "HMAC SHA3-512", CKM_SHA3_512_HMAC, INVALID_CERT_EXTENSION),

    ODE(SEC_OID_XYBER768D00,
        "X25519+Kyber768 key exchange", CKM_INVALID_MECHANISM, INVALID_CERT_EXTENSION),
};

/* PRIVATE EXTENDED SECOID Table
 * This table is private. Its structure is opaque to the outside.
 * It is indexed by the same SECOidTag as the oids table above.
 * Every member of this struct must have accessor functions (set, get)
 * and those functions must operate by value, not by reference.
 * The addresses of the contents of this table must not be exposed
 * by the accessor functions.
 */
typedef struct privXOidStr {
    PRUint32 notPolicyFlags; /* ones complement of policy flags */
} privXOid;

static privXOid xOids[SEC_OID_TOTAL];

/*
 * now the dynamic table. The dynamic table gets build at init time.
 * and conceivably gets modified if the user loads new crypto modules.
 * All this static data, and the allocated data to which it points,
 * is protected by a global reader/writer lock.
 * The c language guarantees that global and static data that is not
 * explicitly initialized will be initialized with zeros.  If we
 * initialize it with zeros, the data goes into the initialized data
 * secment, and increases the size of the library.  By leaving it
 * uninitialized, it is allocated in BSS, and does NOT increase the
 * library size.
 */

typedef struct dynXOidStr {
    SECOidData data;
    privXOid priv;
} dynXOid;

static NSSRWLock *dynOidLock;
static PLArenaPool *dynOidPool;
static PLHashTable *dynOidHash;
static dynXOid **dynOidTable; /* not in the pool */
static int dynOidEntriesAllocated;
static int dynOidEntriesUsed;

/* Creates NSSRWLock and dynOidPool at initialization time.
*/
static SECStatus
secoid_InitDynOidData(void)
{
    SECStatus rv = SECSuccess;

    dynOidLock = NSSRWLock_New(1, "dynamic OID data");
    if (!dynOidLock) {
        return SECFailure; /* Error code should already be set. */
    }
    dynOidPool = PORT_NewArena(2048);
    if (!dynOidPool) {
        rv = SECFailure /* Error code should already be set. */;
    }
    return rv;
}

/* Add oidData to hash table.  Caller holds write lock dynOidLock. */
static SECStatus
secoid_HashDynamicOiddata(const SECOidData *oid)
{
    PLHashEntry *entry;

    if (!dynOidHash) {
        dynOidHash = PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare,
                                     PL_CompareValues, NULL, NULL);
        if (!dynOidHash) {
            return SECFailure;
        }
    }

    entry = PL_HashTableAdd(dynOidHash, &oid->oid, (void *)oid);
    return entry ? SECSuccess : SECFailure;
}

/*
 * Lookup a Dynamic OID. Dynamic OID's still change slowly, so it's
 * cheaper to rehash the table when it changes than it is to do the loop
 * each time.
 */
static SECOidData *
secoid_FindDynamic(const SECItem *key)
{
    SECOidData *ret = NULL;

    NSSRWLock_LockRead(dynOidLock);
    if (dynOidHash) {
        ret = (SECOidData *)PL_HashTableLookup(dynOidHash, key);
    }
    NSSRWLock_UnlockRead(dynOidLock);
    if (ret == NULL) {
        PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
    }
    return ret;
}

static dynXOid *
secoid_FindDynamicByTag(SECOidTag tagnum)
{
    dynXOid *dxo = NULL;
    int tagNumDiff;

    if (tagnum < SEC_OID_TOTAL) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
        return NULL;
    }
    tagNumDiff = tagnum - SEC_OID_TOTAL;

    NSSRWLock_LockRead(dynOidLock);
    if (dynOidTable != NULL &&
        tagNumDiff < dynOidEntriesUsed) {
        dxo = dynOidTable[tagNumDiff];
    }
    NSSRWLock_UnlockRead(dynOidLock);
    if (dxo == NULL) {
        PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
    }
    return dxo;
}

/*
 * This routine is thread safe now.
 */
SECOidTag
SECOID_AddEntry(const SECOidData *src)
{
    SECOidData *dst;
    dynXOid **table;
    SECOidTag ret = SEC_OID_UNKNOWN;
    SECStatus rv;
    int tableEntries;
    int used;

    if (!src || !src->oid.data || !src->oid.len ||
        !src->desc || !strlen(src->desc)) {
        PORT_SetError(SEC_ERROR_INVALID_ARGS);
        return ret;
    }
    if (src->supportedExtension != INVALID_CERT_EXTENSION &&
        src->supportedExtension != UNSUPPORTED_CERT_EXTENSION &&
        src->supportedExtension != SUPPORTED_CERT_EXTENSION) {
        PORT_SetError(SEC_ERROR_INVALID_ARGS);
        return ret;
    }

    if (!dynOidPool || !dynOidLock) {
        PORT_SetError(SEC_ERROR_NOT_INITIALIZED);
        return ret;
    }

    NSSRWLock_LockWrite(dynOidLock);

    /* We've just acquired the write lock, and now we call FindOIDTag
    ** which will acquire and release the read lock.  NSSRWLock has been
    ** designed to allow this very case without deadlock.  This approach
    ** makes the test for the presence of the OID, and the subsequent
    ** addition of the OID to the table a single atomic write operation.
    */
    ret = SECOID_FindOIDTag(&src->oid);
    if (ret != SEC_OID_UNKNOWN) {
        /* we could return an error here, but I chose not to do that.
        ** This way, if we add an OID to the shared library's built in
        ** list of OIDs in some future release, and that OID is the same
        ** as some OID that a program has been adding, the program will
        ** not suddenly stop working.
        */
        goto done;
    }

    table = dynOidTable;
    tableEntries = dynOidEntriesAllocated;
    used = dynOidEntriesUsed;

    if (used + 1 > tableEntries) {
        dynXOid **newTable;
        int newTableEntries = tableEntries + 16;

        newTable = (dynXOid **)PORT_Realloc(table,
                                            newTableEntries * sizeof(dynXOid *));
        if (newTable == NULL) {
            goto done;
        }
        dynOidTable = table = newTable;
        dynOidEntriesAllocated = tableEntries = newTableEntries;
    }

    /* copy oid structure */
    dst = (SECOidData *)PORT_ArenaZNew(dynOidPool, dynXOid);
    if (!dst) {
        goto done;
    }
    rv = SECITEM_CopyItem(dynOidPool, &dst->oid, &src->oid);
    if (rv != SECSuccess) {
        goto done;
    }
    dst->desc = PORT_ArenaStrdup(dynOidPool, src->desc);
    if (!dst->desc) {
        goto done;
    }
    dst->offset = (SECOidTag)(used + SEC_OID_TOTAL);
    dst->mechanism = src->mechanism;
    dst->supportedExtension = src->supportedExtension;

    rv = secoid_HashDynamicOiddata(dst);
    if (rv == SECSuccess) {
        table[used++] = (dynXOid *)dst;
        dynOidEntriesUsed = used;
        ret = dst->offset;
    }
done:
    NSSRWLock_UnlockWrite(dynOidLock);
    return ret;
}

/* normal static table processing */
static PLHashTable *oidhash = NULL;
static PLHashTable *oidmechhash = NULL;

static PLHashNumber
secoid_HashNumber(const void *key)
{
    return (PLHashNumber)((char *)key - (char *)NULL);
}

#define DEF_FLAGS (NSS_USE_ALG_IN_CERT_SIGNATURE | NSS_USE_ALG_IN_SSL_KX | NSS_USE_ALG_IN_SSL_KX)
static void
handleHashAlgSupport(char *envVal)
{
    char *myVal = PORT_Strdup(envVal); /* Get a copy we can alter */
    char *arg = myVal;

    while (arg && *arg) {
        char *nextArg = PL_strpbrk(arg, ";");
        PRUint32 notEnable;

        if (nextArg) {
            while (*nextArg == ';') {
                *nextArg++ = '\0';
            }
        }
        notEnable = (*arg == '-') ? (DEF_FLAGS) : 0;
        if ((*arg == '+' || *arg == '-') && *++arg) {
            int i;

            for (i = 1; i < SEC_OID_TOTAL; i++) {
                if (oids[i].desc && strstr(arg, oids[i].desc)) {
                    xOids[i].notPolicyFlags = notEnable |
                                              (xOids[i].notPolicyFlags & ~(DEF_FLAGS));
                }
            }
        }
        arg = nextArg;
    }
    PORT_Free(myVal); /* can handle NULL argument OK */
}

SECStatus
SECOID_Init(void)
{
    PLHashEntry *entry;
    const SECOidData *oid;
    SECOidTag i;
    char *envVal;

#define NSS_VERSION_VARIABLE __nss_util_version
#include "verref.h"

    if (oidhash) {
        return SECSuccess; /* already initialized */
    }

    /* xyber768d00 must be enabled explicitly */
    xOids[SEC_OID_XYBER768D00].notPolicyFlags = NSS_USE_ALG_IN_SSL_KX;

    if (!PR_GetEnvSecure("NSS_ALLOW_WEAK_SIGNATURE_ALG")) {
        /* initialize any policy flags that are disabled by default */
        xOids[SEC_OID_MD2].notPolicyFlags = ~0;
        xOids[SEC_OID_MD4].notPolicyFlags = ~0;
        xOids[SEC_OID_MD5].notPolicyFlags = ~0;
        xOids[SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION].notPolicyFlags = ~0;
        xOids[SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION].notPolicyFlags = ~0;
        xOids[SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION].notPolicyFlags = ~0;
        xOids[SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC].notPolicyFlags = ~0;
        xOids[SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC].notPolicyFlags = ~0;
    }

    /* turn off NSS_USE_POLICY_IN_SSL by default */
    xOids[SEC_OID_APPLY_SSL_POLICY].notPolicyFlags = NSS_USE_POLICY_IN_SSL;

    envVal = PR_GetEnvSecure("NSS_HASH_ALG_SUPPORT");
    if (envVal)
        handleHashAlgSupport(envVal);

    if (secoid_InitDynOidData() != SECSuccess) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
        PORT_Assert(0); /* this function should never fail */
        return SECFailure;
    }

    oidhash = PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare,
                              PL_CompareValues, NULL, NULL);
    oidmechhash = PL_NewHashTable(0, secoid_HashNumber, PL_CompareValues,
                                  PL_CompareValues, NULL, NULL);

    if (!oidhash || !oidmechhash) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
        PORT_Assert(0); /*This function should never fail. */
        return (SECFailure);
    }

    for (i = 0; i < SEC_OID_TOTAL; i++) {
        oid = &oids[i];

        PORT_Assert(oid->offset == i);

        entry = PL_HashTableAdd(oidhash, &oid->oid, (void *)oid);
        if (entry == NULL) {
            PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
            PORT_Assert(0); /*This function should never fail. */
            return (SECFailure);
        }

        if (oid->mechanism != CKM_INVALID_MECHANISM) {
            entry = PL_HashTableAdd(oidmechhash,
                                    (void *)(uintptr_t)oid->mechanism, (void *)oid);
            if (entry == NULL) {
                PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
                PORT_Assert(0); /* This function should never fail. */
                return (SECFailure);
            }
        }
    }

    PORT_Assert(i == SEC_OID_TOTAL);

    return (SECSuccess);
}

SECOidData *
SECOID_FindOIDByMechanism(unsigned long mechanism)
{
    SECOidData *ret;

    PR_ASSERT(oidmechhash != NULL);
    if (oidmechhash == NULL && SECOID_Init() != SECSuccess) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
        return NULL;
    }

    ret = PL_HashTableLookupConst(oidmechhash, (void *)(uintptr_t)mechanism);
    if (ret == NULL) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
    }

    return (ret);
}

SECOidData *
SECOID_FindOID(const SECItem *oid)
{
    SECOidData *ret;

    PR_ASSERT(oidhash != NULL);
    if (oidhash == NULL && SECOID_Init() != SECSuccess) {
        PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
        return NULL;
    }

    ret = PL_HashTableLookupConst(oidhash, oid);
    if (ret == NULL) {
        ret = secoid_FindDynamic(oid);
        if (ret == NULL) {
            PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
        }
    }

    return (ret);
}

SECOidTag
SECOID_FindOIDTag(const SECItem *oid)
{
    SECOidData *oiddata;

    oiddata = SECOID_FindOID(oid);
    if (oiddata == NULL)
        return SEC_OID_UNKNOWN;

    return oiddata->offset;
}

/* This really should return const. */
SECOidData *
SECOID_FindOIDByTag(SECOidTag tagnum)
{
    if (tagnum >= SEC_OID_TOTAL) {
        return (SECOidData *)secoid_FindDynamicByTag(tagnum);
    }

    PORT_Assert((unsigned int)tagnum < SEC_OID_TOTAL);
    return (SECOidData *)(&oids[tagnum]);
}

PRBool
SECOID_KnownCertExtenOID(SECItem *extenOid)
{
    SECOidData *oidData;

    oidData = SECOID_FindOID(extenOid);
    if (oidData == (SECOidData *)NULL)
        return (PR_FALSE);
    return ((oidData->supportedExtension == SUPPORTED_CERT_EXTENSION) ? PR_TRUE : PR_FALSE);
}

const char *
SECOID_FindOIDTagDescription(SECOidTag tagnum)
{
    const SECOidData *oidData = SECOID_FindOIDByTag(tagnum);
    return oidData ? oidData->desc : 0;
}

/* --------- opaque extended OID table accessor functions ---------------*/
/*
 * Any of these functions may return SECSuccess or SECFailure with the error
 * code set to SEC_ERROR_UNKNOWN_OBJECT_TYPE if the SECOidTag is out of range.
 */

static privXOid *
secoid_FindXOidByTag(SECOidTag tagnum)
{
    if (tagnum >= SEC_OID_TOTAL) {
        dynXOid *dxo = secoid_FindDynamicByTag(tagnum);
        return (dxo ? &dxo->priv : NULL);
    }

    PORT_Assert((unsigned int)tagnum < SEC_OID_TOTAL);
    return &xOids[tagnum];
}

/* The Get function outputs the 32-bit value associated with the SECOidTag.
 * Flags bits are the NSS_USE_ALG_ #defines in "secoidt.h".
 * Default value for any algorithm is 0xffffffff (enabled for all purposes).
 * No value is output if function returns SECFailure.
 */
SECStatus
NSS_GetAlgorithmPolicy(SECOidTag tag, PRUint32 *pValue)
{
    privXOid *pxo = secoid_FindXOidByTag(tag);
    if (!pxo)
        return SECFailure;
    if (!pValue) {
        PORT_SetError(SEC_ERROR_INVALID_ARGS);
        return SECFailure;
    }
    *pValue = ~(pxo->notPolicyFlags);
    return SECSuccess;
}

static PRBool nss_policy_locked = PR_FALSE;

/* The Set function modifies the stored value according to the following
 * algorithm:
 *   policy[tag] = (policy[tag] & ~clearBits) | setBits;
 */
SECStatus
NSS_SetAlgorithmPolicy(SECOidTag tag, PRUint32 setBits, PRUint32 clearBits)
{
    privXOid *pxo = secoid_FindXOidByTag(tag);
    PRUint32 policyFlags;
    if (!pxo)
        return SECFailure;

    if (nss_policy_locked) {
        PORT_SetError(SEC_ERROR_POLICY_LOCKED);
        return SECFailure;
    }
    /* The stored policy flags are the ones complement of the flags as
     * seen by the user.  This is not atomic, but these changes should
     * be done rarely, e.g. at initialization time.
     */
    policyFlags = ~(pxo->notPolicyFlags);
    policyFlags = (policyFlags & ~clearBits) | setBits;
    pxo->notPolicyFlags = ~policyFlags;
    return SECSuccess;
}

/* Get the state of nss_policy_locked */
PRBool
NSS_IsPolicyLocked(void)
{
    return nss_policy_locked;
}

/* Once the policy is locked, it can't be unlocked */
void
NSS_LockPolicy(void)
{
    nss_policy_locked = PR_TRUE;
}

/* --------- END OF opaque extended OID table accessor functions ---------*/

/* for now, this is only used in a single place, so it can remain static */
static PRBool parentForkedAfterC_Initialize;

#define SKIP_AFTER_FORK(x)              \
    if (!parentForkedAfterC_Initialize) \
    x

/*
 * free up the oid tables.
 */
SECStatus
SECOID_Shutdown(void)
{
    if (oidhash) {
        PL_HashTableDestroy(oidhash);
        oidhash = NULL;
    }
    if (oidmechhash) {
        PL_HashTableDestroy(oidmechhash);
        oidmechhash = NULL;
    }
    /* Have to handle the case where the lock was created, but
    ** the pool wasn't.
    ** I'm not going to attempt to create the lock, just to protect
    ** the destruction of data that probably isn't initialized anyway.
    */
    if (dynOidLock) {
        SKIP_AFTER_FORK(NSSRWLock_LockWrite(dynOidLock));
        if (dynOidHash) {
            PL_HashTableDestroy(dynOidHash);
            dynOidHash = NULL;
        }
        if (dynOidPool) {
            PORT_FreeArena(dynOidPool, PR_FALSE);
            dynOidPool = NULL;
        }
        if (dynOidTable) {
            PORT_Free(dynOidTable);
            dynOidTable = NULL;
        }
        dynOidEntriesAllocated = 0;
        dynOidEntriesUsed = 0;

        SKIP_AFTER_FORK(NSSRWLock_UnlockWrite(dynOidLock));
        SKIP_AFTER_FORK(NSSRWLock_Destroy(dynOidLock));
        dynOidLock = NULL;
    } else {
        /* Since dynOidLock doesn't exist, then all the data it protects
        ** should be uninitialized.  We'll check that (in DEBUG builds),
        ** and then make sure it is so, in case NSS is reinitialized.
        */
        PORT_Assert(!dynOidHash && !dynOidPool && !dynOidTable &&
                    !dynOidEntriesAllocated && !dynOidEntriesUsed);
        dynOidHash = NULL;
        dynOidPool = NULL;
        dynOidTable = NULL;
        dynOidEntriesAllocated = 0;
        dynOidEntriesUsed = 0;
    }
    /* we are trashing the old policy state now, also reenable changing
     * the policy as well */
    nss_policy_locked = PR_FALSE;
    memset(xOids, 0, sizeof xOids);
    return SECSuccess;
}

void
UTIL_SetForkState(PRBool forked)
{
    parentForkedAfterC_Initialize = forked;
}

const char *
NSSUTIL_GetVersion(void)
{
    return NSSUTIL_VERSION;
}