]> git.saurik.com Git - apple/security.git/blob - libsecurity_smime/lib/secoid.c
Security-59754.80.3.tar.gz
[apple/security.git] / libsecurity_smime / lib / secoid.c
1 /*
2 * The contents of this file are subject to the Mozilla Public
3 * License Version 1.1 (the "License"); you may not use this file
4 * except in compliance with the License. You may obtain a copy of
5 * the License at http://www.mozilla.org/MPL/
6 *
7 * Software distributed under the License is distributed on an "AS
8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9 * implied. See the License for the specific language governing
10 * rights and limitations under the License.
11 *
12 * The Original Code is the Netscape security libraries.
13 *
14 * The Initial Developer of the Original Code is Netscape
15 * Communications Corporation. Portions created by Netscape are
16 * Copyright (C) 1994-2000 Netscape Communications Corporation. All
17 * Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * Alternatively, the contents of this file may be used under the
22 * terms of the GNU General Public License Version 2 or later (the
23 * "GPL"), in which case the provisions of the GPL are applicable
24 * instead of those above. If you wish to allow use of your
25 * version of this file only under the terms of the GPL and not to
26 * allow others to use your version of this file under the MPL,
27 * indicate your decision by deleting the provisions above and
28 * replace them with the notice and other provisions required by
29 * the GPL. If you do not delete the provisions above, a recipient
30 * may use your version of this file under either the MPL or the
31 * GPL.
32 */
33
34 #include "secoid.h"
35 #include "SecAsn1Item.h"
36 #include "plhash.h"
37
38 #include <security_asn1/secerr.h>
39 #include <security_asn1/secport.h>
40
41 #if USE_CDSA_CRYPTO
42 #include <Security/cssmapple.h>
43 #else
44 #include <Security/oidsalg.h>
45 #include <CommonCrypto/CommonCryptor.h>
46 #endif
47 #include <pthread.h>
48
49 /* MISSI Mosaic Object ID space */
50 #define USGOV 0x60, 0x86, 0x48, 0x01, 0x65
51 #define MISSI USGOV, 0x02, 0x01, 0x01
52 #define MISSI_OLD_KEA_DSS MISSI, 0x0c
53 #define MISSI_OLD_DSS MISSI, 0x02
54 #define MISSI_KEA_DSS MISSI, 0x14
55 #define MISSI_DSS MISSI, 0x13
56 #define MISSI_KEA MISSI, 0x0a
57 #define MISSI_ALT_KEA MISSI, 0x16
58
59 #define NISTALGS USGOV, 3, 4
60 #define AES NISTALGS, 1
61 #define SHAXXX NISTALGS, 2
62
63 /**
64 ** The Netscape OID space is allocated by Terry Hayes. If you need
65 ** a piece of the space, contact him at thayes@netscape.com.
66 **/
67
68 /* Netscape Communications Corporation Object ID space */
69 /* { 2 16 840 1 113730 } */
70 #define NETSCAPE_OID 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42
71 #define NETSCAPE_CERT_EXT NETSCAPE_OID, 0x01
72 #define NETSCAPE_DATA_TYPE NETSCAPE_OID, 0x02
73 /* netscape directory oid - owned by Mark Smith (mcs@netscape.com) */
74 #define NETSCAPE_DIRECTORY NETSCAPE_OID, 0x03
75 #define NETSCAPE_POLICY NETSCAPE_OID, 0x04
76 #define NETSCAPE_CERT_SERVER NETSCAPE_OID, 0x05
77 #define NETSCAPE_ALGS NETSCAPE_OID, 0x06 /* algorithm OIDs */
78 #define NETSCAPE_NAME_COMPONENTS NETSCAPE_OID, 0x07
79
80 #define NETSCAPE_CERT_EXT_AIA NETSCAPE_CERT_EXT, 0x10
81 #define NETSCAPE_CERT_SERVER_CRMF NETSCAPE_CERT_SERVER, 0x01
82
83 /* these are old and should go away soon */
84 #define OLD_NETSCAPE 0x60, 0x86, 0x48, 0xd8, 0x6a
85 #define NS_CERT_EXT OLD_NETSCAPE, 0x01
86 #define NS_FILE_TYPE OLD_NETSCAPE, 0x02
87 #define NS_IMAGE_TYPE OLD_NETSCAPE, 0x03
88
89 /* RSA OID name space */
90 #define RSADSI 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d
91 #define PKCS RSADSI, 0x01
92 #define DIGEST RSADSI, 0x02
93 #define CIPHER RSADSI, 0x03
94 #define PKCS1 PKCS, 0x01
95 #define PKCS5 PKCS, 0x05
96 #define PKCS7 PKCS, 0x07
97 #define PKCS9 PKCS, 0x09
98 #define PKCS12 PKCS, 0x0c
99
100 /* Fortezza algorithm OID space: { 2 16 840 1 101 2 1 1 } */
101 /* ### mwelch -- Is this just for algorithms, or all of Fortezza? */
102 #define FORTEZZA_ALG 0x60, 0x86, 0x48, 0x01, 0x65, 0x02, 0x01, 0x01
103
104 /* Other OID name spaces */
105 #define ALGORITHM 0x2b, 0x0e, 0x03, 0x02
106 #define X500 0x55
107 #define X520_ATTRIBUTE_TYPE X500, 0x04
108 #define X500_ALG X500, 0x08
109 #define X500_ALG_ENCRYPTION X500_ALG, 0x01
110
111 /** X.509 v3 Extension OID
112 ** {joint-iso-ccitt (2) ds(5) 29}
113 **/
114 #define ID_CE_OID X500, 0x1d
115
116 #define RFC1274_ATTR_TYPE 0x09, 0x92, 0x26, 0x89, 0x93, 0xf2, 0x2c, 0x64, 0x1
117 /* #define RFC2247_ATTR_TYPE 0x09, 0x92, 0x26, 0xf5, 0x98, 0x1e, 0x64, 0x1 this is WRONG! */
118
119 /* PKCS #12 name spaces */
120 #define PKCS12_MODE_IDS PKCS12, 0x01
121 #define PKCS12_ESPVK_IDS PKCS12, 0x02
122 #define PKCS12_BAG_IDS PKCS12, 0x03
123 #define PKCS12_CERT_BAG_IDS PKCS12, 0x04
124 #define PKCS12_OIDS PKCS12, 0x05
125 #define PKCS12_PBE_IDS PKCS12_OIDS, 0x01
126 #define PKCS12_ENVELOPING_IDS PKCS12_OIDS, 0x02
127 #define PKCS12_SIGNATURE_IDS PKCS12_OIDS, 0x03
128 #define PKCS12_V2_PBE_IDS PKCS12, 0x01
129 #define PKCS9_CERT_TYPES PKCS9, 0x16
130 #define PKCS9_CRL_TYPES PKCS9, 0x17
131 #define PKCS9_SMIME_IDS PKCS9, 0x10
132 #define PKCS9_SMIME_CTYPE PKCS9_SMIME_IDS, 1
133 #define PKCS9_SMIME_ATTRS PKCS9_SMIME_IDS, 2
134 #define PKCS9_SMIME_ALGS PKCS9_SMIME_IDS, 3
135 #define PKCS12_VERSION1 PKCS12, 0x0a
136 #define PKCS12_V1_BAG_IDS PKCS12_VERSION1, 1
137
138 /* for DSA algorithm */
139 /* { iso(1) member-body(2) us(840) x9-57(10040) x9algorithm(4) } */
140 #define ANSI_X9_ALGORITHM 0x2a, 0x86, 0x48, 0xce, 0x38, 0x4
141
142 /* for DH algorithm */
143 /* { iso(1) member-body(2) us(840) x9-57(10046) number-type(2) } */
144 /* need real OID person to look at this, copied the above line
145 * and added 6 to second to last value (and changed '4' to '2' */
146 #define ANSI_X942_ALGORITHM 0x2a, 0x86, 0x48, 0xce, 0x3e, 0x2
147
148 #define VERISIGN 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x45
149
150 #define PKIX 0x2b, 0x06, 0x01, 0x05, 0x05, 0x07
151 #define PKIX_CERT_EXTENSIONS PKIX, 1
152 #define PKIX_POLICY_QUALIFIERS PKIX, 2
153 #define PKIX_KEY_USAGE PKIX, 3
154 #define PKIX_ACCESS_DESCRIPTION PKIX, 0x30
155 #define PKIX_OCSP PKIX_ACCESS_DESCRIPTION, 1
156
157 #define PKIX_ID_PKIP PKIX, 5
158 #define PKIX_ID_REGCTRL PKIX_ID_PKIP, 1
159 #define PKIX_ID_REGINFO PKIX_ID_PKIP, 2
160
161 /* Microsoft Object ID space */
162 /* { 1.3.6.1.4.1.311 } */
163 #define MICROSOFT_OID 0x2b, 0x6, 0x1, 0x4, 0x1, 0x82, 0x37
164
165 /* ECDSA OIDs from X9.62 */
166 #define ANSI_X9_62 0x2A, 0x86, 0x48, 0xCE, 0x3D
167 #define ANSI_X9_62_FIELD_TYPE ANSI_X9_62, 1
168 #define ANSI_X9_62_PUBKEY_TYPE ANSI_X9_62, 2
169 #define ANSI_X9_62_SIG_TYPE ANSI_X9_62, 4
170 #define ECDSA_WITH_SHA2 ANSI_X9_62_SIG_TYPE, 3
171
172 /* X9.63 schemes */
173 #define ANSI_X9_63 0x2B, 0x81, 0x05, 0x10, 0x86, 0x48, 0x3F
174 #define ANSI_X9_63_SCHEME ANSI_X9_63, 0
175
176 /* ECDH curves */
177 #define CERTICOM_ELL_CURVE 0x2B, 0x81, 0x04, 0x00
178
179 /* Apple OID sapce */
180 /* 1.2.840.113635 */
181 #define APPLE_OID 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x63
182 #define APPLE_DATA_SECURITY APPLE_OID, 0x64
183 #define APPLE_CMS_ATTRIBUTES APPLE_DATA_SECURITY, 0x9
184
185 #define CONST_OID static const unsigned char
186
187 CONST_OID null_oid[] = { };
188
189 CONST_OID md2[] = { DIGEST, 0x02 };
190 CONST_OID md4[] = { DIGEST, 0x04 };
191 CONST_OID md5[] = { DIGEST, 0x05 };
192
193 CONST_OID rc2cbc[] = { CIPHER, 0x02 };
194 CONST_OID rc4[] = { CIPHER, 0x04 };
195 CONST_OID desede3cbc[] = { CIPHER, 0x07 };
196 CONST_OID rc5cbcpad[] = { CIPHER, 0x09 };
197
198 CONST_OID desecb[] = { ALGORITHM, 0x06 };
199 CONST_OID descbc[] = { ALGORITHM, 0x07 };
200 CONST_OID desofb[] = { ALGORITHM, 0x08 };
201 CONST_OID descfb[] = { ALGORITHM, 0x09 };
202 CONST_OID desmac[] = { ALGORITHM, 0x0a };
203 CONST_OID sdn702DSASignature[] = { ALGORITHM, 0x0c };
204 CONST_OID isoSHAWithRSASignature[] = { ALGORITHM, 0x0f };
205 CONST_OID desede[] = { ALGORITHM, 0x11 };
206 CONST_OID sha1[] = { ALGORITHM, 0x1a };
207 CONST_OID bogusDSASignaturewithSHA1Digest[] = { ALGORITHM, 0x1b };
208
209 CONST_OID pkcs1RSAEncryption[] = { PKCS1, 0x01 };
210 CONST_OID pkcs1MD2WithRSAEncryption[] = { PKCS1, 0x02 };
211 CONST_OID pkcs1MD4WithRSAEncryption[] = { PKCS1, 0x03 };
212 CONST_OID pkcs1MD5WithRSAEncryption[] = { PKCS1, 0x04 };
213 CONST_OID pkcs1SHA1WithRSAEncryption[] = { PKCS1, 0x05 };
214 CONST_OID pkcs1SHA256WithRSAEncryption[] = { PKCS1, 11 };
215 CONST_OID pkcs1SHA384WithRSAEncryption[] = { PKCS1, 12 };
216 CONST_OID pkcs1SHA512WithRSAEncryption[] = { PKCS1, 13 };
217
218 CONST_OID pkcs5PbeWithMD2AndDEScbc[] = { PKCS5, 0x01 };
219 CONST_OID pkcs5PbeWithMD5AndDEScbc[] = { PKCS5, 0x03 };
220 CONST_OID pkcs5PbeWithSha1AndDEScbc[] = { PKCS5, 0x0a };
221
222 CONST_OID pkcs7[] = { PKCS7 };
223 CONST_OID pkcs7Data[] = { PKCS7, 0x01 };
224 CONST_OID pkcs7SignedData[] = { PKCS7, 0x02 };
225 CONST_OID pkcs7EnvelopedData[] = { PKCS7, 0x03 };
226 CONST_OID pkcs7SignedEnvelopedData[] = { PKCS7, 0x04 };
227 CONST_OID pkcs7DigestedData[] = { PKCS7, 0x05 };
228 CONST_OID pkcs7EncryptedData[] = { PKCS7, 0x06 };
229
230 CONST_OID pkcs9EmailAddress[] = { PKCS9, 0x01 };
231 CONST_OID pkcs9UnstructuredName[] = { PKCS9, 0x02 };
232 CONST_OID pkcs9ContentType[] = { PKCS9, 0x03 };
233 CONST_OID pkcs9MessageDigest[] = { PKCS9, 0x04 };
234 CONST_OID pkcs9SigningTime[] = { PKCS9, 0x05 };
235 CONST_OID pkcs9CounterSignature[] = { PKCS9, 0x06 };
236 CONST_OID pkcs9ChallengePassword[] = { PKCS9, 0x07 };
237 CONST_OID pkcs9UnstructuredAddress[] = { PKCS9, 0x08 };
238 CONST_OID pkcs9ExtendedCertificateAttributes[] = { PKCS9, 0x09 };
239 CONST_OID pkcs9SMIMECapabilities[] = { PKCS9, 15 };
240 CONST_OID pkcs9FriendlyName[] = { PKCS9, 20 };
241 CONST_OID pkcs9LocalKeyID[] = { PKCS9, 21 };
242
243 CONST_OID pkcs9X509Certificate[] = { PKCS9_CERT_TYPES, 1 };
244 CONST_OID pkcs9SDSICertificate[] = { PKCS9_CERT_TYPES, 2 };
245 CONST_OID pkcs9X509CRL[] = { PKCS9_CRL_TYPES, 1 };
246
247 /* RFC2630 (CMS) OIDs */
248 CONST_OID cmsESDH[] = { PKCS9_SMIME_ALGS, 5 };
249 CONST_OID cms3DESwrap[] = { PKCS9_SMIME_ALGS, 6 };
250 CONST_OID cmsRC2wrap[] = { PKCS9_SMIME_ALGS, 7 };
251
252 /* RFC2633 SMIME message attributes */
253 CONST_OID smimeEncryptionKeyPreference[] = { PKCS9_SMIME_ATTRS, 11 };
254 CONST_OID ms_smimeEncryptionKeyPreference[] = { MICROSOFT_OID, 0x10, 0x4 };
255
256 CONST_OID smimeSigningCertificate[] = { PKCS9_SMIME_ATTRS, 12 };
257 CONST_OID smimeTimeStampToken[] = { PKCS9_SMIME_ATTRS, 14 };
258 CONST_OID smimeTimeStampTokenInfo[] = { PKCS9_SMIME_CTYPE, 0x04 };
259
260 CONST_OID x520CommonName[] = { X520_ATTRIBUTE_TYPE, 3 };
261 CONST_OID x520CountryName[] = { X520_ATTRIBUTE_TYPE, 6 };
262 CONST_OID x520LocalityName[] = { X520_ATTRIBUTE_TYPE, 7 };
263 CONST_OID x520StateOrProvinceName[] = { X520_ATTRIBUTE_TYPE, 8 };
264 CONST_OID x520OrgName[] = { X520_ATTRIBUTE_TYPE, 10 };
265 CONST_OID x520OrgUnitName[] = { X520_ATTRIBUTE_TYPE, 11 };
266 CONST_OID x520DnQualifier[] = { X520_ATTRIBUTE_TYPE, 46 };
267
268 CONST_OID nsTypeGIF[] = { NETSCAPE_DATA_TYPE, 0x01 };
269 CONST_OID nsTypeJPEG[] = { NETSCAPE_DATA_TYPE, 0x02 };
270 CONST_OID nsTypeURL[] = { NETSCAPE_DATA_TYPE, 0x03 };
271 CONST_OID nsTypeHTML[] = { NETSCAPE_DATA_TYPE, 0x04 };
272 CONST_OID nsTypeCertSeq[] = { NETSCAPE_DATA_TYPE, 0x05 };
273
274 CONST_OID missiCertKEADSSOld[] = { MISSI_OLD_KEA_DSS };
275 CONST_OID missiCertDSSOld[] = { MISSI_OLD_DSS };
276 CONST_OID missiCertKEADSS[] = { MISSI_KEA_DSS };
277 CONST_OID missiCertDSS[] = { MISSI_DSS };
278 CONST_OID missiCertKEA[] = { MISSI_KEA };
279 CONST_OID missiCertAltKEA[] = { MISSI_ALT_KEA };
280 CONST_OID x500RSAEncryption[] = { X500_ALG_ENCRYPTION, 0x01 };
281
282 /* added for alg 1485 */
283 CONST_OID rfc1274Uid[] = { RFC1274_ATTR_TYPE, 1 };
284 CONST_OID rfc1274Mail[] = { RFC1274_ATTR_TYPE, 3 };
285 CONST_OID rfc2247DomainComponent[] = { RFC1274_ATTR_TYPE, 25 };
286
287 /* Netscape private certificate extensions */
288 CONST_OID nsCertExtNetscapeOK[] = { NS_CERT_EXT, 1 };
289 CONST_OID nsCertExtIssuerLogo[] = { NS_CERT_EXT, 2 };
290 CONST_OID nsCertExtSubjectLogo[] = { NS_CERT_EXT, 3 };
291 CONST_OID nsExtCertType[] = { NETSCAPE_CERT_EXT, 0x01 };
292 CONST_OID nsExtBaseURL[] = { NETSCAPE_CERT_EXT, 0x02 };
293 CONST_OID nsExtRevocationURL[] = { NETSCAPE_CERT_EXT, 0x03 };
294 CONST_OID nsExtCARevocationURL[] = { NETSCAPE_CERT_EXT, 0x04 };
295 CONST_OID nsExtCACRLURL[] = { NETSCAPE_CERT_EXT, 0x05 };
296 CONST_OID nsExtCACertURL[] = { NETSCAPE_CERT_EXT, 0x06 };
297 CONST_OID nsExtCertRenewalURL[] = { NETSCAPE_CERT_EXT, 0x07 };
298 CONST_OID nsExtCAPolicyURL[] = { NETSCAPE_CERT_EXT, 0x08 };
299 CONST_OID nsExtHomepageURL[] = { NETSCAPE_CERT_EXT, 0x09 };
300 CONST_OID nsExtEntityLogo[] = { NETSCAPE_CERT_EXT, 0x0a };
301 CONST_OID nsExtUserPicture[] = { NETSCAPE_CERT_EXT, 0x0b };
302 CONST_OID nsExtSSLServerName[] = { NETSCAPE_CERT_EXT, 0x0c };
303 CONST_OID nsExtComment[] = { NETSCAPE_CERT_EXT, 0x0d };
304
305 /* the following 2 extensions are defined for and used by Cartman(NSM) */
306 CONST_OID nsExtLostPasswordURL[] = { NETSCAPE_CERT_EXT, 0x0e };
307 CONST_OID nsExtCertRenewalTime[] = { NETSCAPE_CERT_EXT, 0x0f };
308
309 CONST_OID nsExtAIACertRenewal[] = { NETSCAPE_CERT_EXT_AIA, 0x01 };
310 CONST_OID nsExtCertScopeOfUse[] = { NETSCAPE_CERT_EXT, 0x11 };
311 /* Reserved Netscape (2 16 840 1 113730 1 18) = { NETSCAPE_CERT_EXT, 0x12 }; */
312
313 /* Netscape policy values */
314 CONST_OID nsKeyUsageGovtApproved[] = { NETSCAPE_POLICY, 0x01 };
315
316 /* Netscape other name types */
317 CONST_OID netscapeNickname[] = { NETSCAPE_NAME_COMPONENTS, 0x01};
318 /* Reserved Netscape REF605437
319 (2 16 840 1 113730 7 2) = { NETSCAPE_NAME_COMPONENTS, 0x02 }; */
320
321 /* OIDs needed for cert server */
322 CONST_OID netscapeRecoveryRequest[] = { NETSCAPE_CERT_SERVER_CRMF, 0x01 };
323
324
325 /* Standard x.509 v3 Certificate Extensions */
326 CONST_OID x509SubjectDirectoryAttr[] = { ID_CE_OID, 9 };
327 CONST_OID x509SubjectKeyID[] = { ID_CE_OID, 14 };
328 CONST_OID x509KeyUsage[] = { ID_CE_OID, 15 };
329 CONST_OID x509PrivateKeyUsagePeriod[] = { ID_CE_OID, 16 };
330 CONST_OID x509SubjectAltName[] = { ID_CE_OID, 17 };
331 CONST_OID x509IssuerAltName[] = { ID_CE_OID, 18 };
332 CONST_OID x509BasicConstraints[] = { ID_CE_OID, 19 };
333 CONST_OID x509NameConstraints[] = { ID_CE_OID, 30 };
334 CONST_OID x509CRLDistPoints[] = { ID_CE_OID, 31 };
335 CONST_OID x509CertificatePolicies[] = { ID_CE_OID, 32 };
336 CONST_OID x509PolicyMappings[] = { ID_CE_OID, 33 };
337 CONST_OID x509PolicyConstraints[] = { ID_CE_OID, 34 };
338 CONST_OID x509AuthKeyID[] = { ID_CE_OID, 35 };
339 CONST_OID x509ExtKeyUsage[] = { ID_CE_OID, 37 };
340 CONST_OID x509AuthInfoAccess[] = { PKIX_CERT_EXTENSIONS, 1 };
341
342 /* Standard x.509 v3 CRL Extensions */
343 CONST_OID x509CrlNumber[] = { ID_CE_OID, 20};
344 CONST_OID x509ReasonCode[] = { ID_CE_OID, 21};
345 CONST_OID x509InvalidDate[] = { ID_CE_OID, 24};
346
347 /* pkcs 12 additions */
348 CONST_OID pkcs12[] = { PKCS12 };
349 CONST_OID pkcs12ModeIDs[] = { PKCS12_MODE_IDS };
350 CONST_OID pkcs12ESPVKIDs[] = { PKCS12_ESPVK_IDS };
351 CONST_OID pkcs12BagIDs[] = { PKCS12_BAG_IDS };
352 CONST_OID pkcs12CertBagIDs[] = { PKCS12_CERT_BAG_IDS };
353 CONST_OID pkcs12OIDs[] = { PKCS12_OIDS };
354 CONST_OID pkcs12PBEIDs[] = { PKCS12_PBE_IDS };
355 CONST_OID pkcs12EnvelopingIDs[] = { PKCS12_ENVELOPING_IDS };
356 CONST_OID pkcs12SignatureIDs[] = { PKCS12_SIGNATURE_IDS };
357 CONST_OID pkcs12PKCS8KeyShrouding[] = { PKCS12_ESPVK_IDS, 0x01 };
358 CONST_OID pkcs12KeyBagID[] = { PKCS12_BAG_IDS, 0x01 };
359 CONST_OID pkcs12CertAndCRLBagID[] = { PKCS12_BAG_IDS, 0x02 };
360 CONST_OID pkcs12SecretBagID[] = { PKCS12_BAG_IDS, 0x03 };
361 CONST_OID pkcs12X509CertCRLBag[] = { PKCS12_CERT_BAG_IDS, 0x01 };
362 CONST_OID pkcs12SDSICertBag[] = { PKCS12_CERT_BAG_IDS, 0x02 };
363 CONST_OID pkcs12PBEWithSha1And128BitRC4[] = { PKCS12_PBE_IDS, 0x01 };
364 CONST_OID pkcs12PBEWithSha1And40BitRC4[] = { PKCS12_PBE_IDS, 0x02 };
365 CONST_OID pkcs12PBEWithSha1AndTripleDESCBC[] = { PKCS12_PBE_IDS, 0x03 };
366 CONST_OID pkcs12PBEWithSha1And128BitRC2CBC[] = { PKCS12_PBE_IDS, 0x04 };
367 CONST_OID pkcs12PBEWithSha1And40BitRC2CBC[] = { PKCS12_PBE_IDS, 0x05 };
368 CONST_OID pkcs12RSAEncryptionWith128BitRC4[] = { PKCS12_ENVELOPING_IDS, 0x01 };
369 CONST_OID pkcs12RSAEncryptionWith40BitRC4[] = { PKCS12_ENVELOPING_IDS, 0x02 };
370 CONST_OID pkcs12RSAEncryptionWithTripleDES[] = { PKCS12_ENVELOPING_IDS, 0x03 };
371 CONST_OID pkcs12RSASignatureWithSHA1Digest[] = { PKCS12_SIGNATURE_IDS, 0x01 };
372
373 /* pkcs 12 version 1.0 ids */
374 CONST_OID pkcs12V2PBEWithSha1And128BitRC4[] = { PKCS12_V2_PBE_IDS, 0x01 };
375 CONST_OID pkcs12V2PBEWithSha1And40BitRC4[] = { PKCS12_V2_PBE_IDS, 0x02 };
376 CONST_OID pkcs12V2PBEWithSha1And3KeyTripleDEScbc[]= { PKCS12_V2_PBE_IDS, 0x03 };
377 CONST_OID pkcs12V2PBEWithSha1And2KeyTripleDEScbc[]= { PKCS12_V2_PBE_IDS, 0x04 };
378 CONST_OID pkcs12V2PBEWithSha1And128BitRC2cbc[] = { PKCS12_V2_PBE_IDS, 0x05 };
379 CONST_OID pkcs12V2PBEWithSha1And40BitRC2cbc[] = { PKCS12_V2_PBE_IDS, 0x06 };
380
381 CONST_OID pkcs12SafeContentsID[] = { PKCS12_BAG_IDS, 0x04 };
382 CONST_OID pkcs12PKCS8ShroudedKeyBagID[] = { PKCS12_BAG_IDS, 0x05 };
383
384 CONST_OID pkcs12V1KeyBag[] = { PKCS12_V1_BAG_IDS, 0x01 };
385 CONST_OID pkcs12V1PKCS8ShroudedKeyBag[] = { PKCS12_V1_BAG_IDS, 0x02 };
386 CONST_OID pkcs12V1CertBag[] = { PKCS12_V1_BAG_IDS, 0x03 };
387 CONST_OID pkcs12V1CRLBag[] = { PKCS12_V1_BAG_IDS, 0x04 };
388 CONST_OID pkcs12V1SecretBag[] = { PKCS12_V1_BAG_IDS, 0x05 };
389 CONST_OID pkcs12V1SafeContentsBag[] = { PKCS12_V1_BAG_IDS, 0x06 };
390
391 CONST_OID pkcs12KeyUsageAttr[] = { 2, 5, 29, 15 };
392
393 CONST_OID ansix9DSASignature[] = { ANSI_X9_ALGORITHM, 0x01 };
394 CONST_OID ansix9DSASignaturewithSHA1Digest[] = { ANSI_X9_ALGORITHM, 0x03 };
395
396 /* verisign OIDs */
397 CONST_OID verisignUserNotices[] = { VERISIGN, 1, 7, 1, 1 };
398
399 /* pkix OIDs */
400 CONST_OID pkixCPSPointerQualifier[] = { PKIX_POLICY_QUALIFIERS, 1 };
401 CONST_OID pkixUserNoticeQualifier[] = { PKIX_POLICY_QUALIFIERS, 2 };
402
403 CONST_OID pkixOCSP[] = { PKIX_OCSP };
404 CONST_OID pkixOCSPBasicResponse[] = { PKIX_OCSP, 1 };
405 CONST_OID pkixOCSPNonce[] = { PKIX_OCSP, 2 };
406 CONST_OID pkixOCSPCRL[] = { PKIX_OCSP, 3 };
407 CONST_OID pkixOCSPResponse[] = { PKIX_OCSP, 4 };
408 CONST_OID pkixOCSPNoCheck[] = { PKIX_OCSP, 5 };
409 CONST_OID pkixOCSPArchiveCutoff[] = { PKIX_OCSP, 6 };
410 CONST_OID pkixOCSPServiceLocator[] = { PKIX_OCSP, 7 };
411
412 CONST_OID pkixRegCtrlRegToken[] = { PKIX_ID_REGCTRL, 1};
413 CONST_OID pkixRegCtrlAuthenticator[] = { PKIX_ID_REGCTRL, 2};
414 CONST_OID pkixRegCtrlPKIPubInfo[] = { PKIX_ID_REGCTRL, 3};
415 CONST_OID pkixRegCtrlPKIArchOptions[] = { PKIX_ID_REGCTRL, 4};
416 CONST_OID pkixRegCtrlOldCertID[] = { PKIX_ID_REGCTRL, 5};
417 CONST_OID pkixRegCtrlProtEncKey[] = { PKIX_ID_REGCTRL, 6};
418 CONST_OID pkixRegInfoUTF8Pairs[] = { PKIX_ID_REGINFO, 1};
419 CONST_OID pkixRegInfoCertReq[] = { PKIX_ID_REGINFO, 2};
420
421 CONST_OID pkixExtendedKeyUsageServerAuth[] = { PKIX_KEY_USAGE, 1 };
422 CONST_OID pkixExtendedKeyUsageClientAuth[] = { PKIX_KEY_USAGE, 2 };
423 CONST_OID pkixExtendedKeyUsageCodeSign[] = { PKIX_KEY_USAGE, 3 };
424 CONST_OID pkixExtendedKeyUsageEMailProtect[] = { PKIX_KEY_USAGE, 4 };
425 CONST_OID pkixExtendedKeyUsageTimeStamp[] = { PKIX_KEY_USAGE, 8 };
426 CONST_OID pkixOCSPResponderExtendedKeyUsage[] = { PKIX_KEY_USAGE, 9 };
427
428 /* OIDs for Netscape defined algorithms */
429 CONST_OID netscapeSMimeKEA[] = { NETSCAPE_ALGS, 0x01 };
430
431 /* Fortezza algorithm OIDs */
432 CONST_OID skipjackCBC[] = { FORTEZZA_ALG, 0x04 };
433 CONST_OID dhPublicKey[] = { ANSI_X942_ALGORITHM, 0x1 };
434
435 CONST_OID aes128_ECB[] = { AES, 1 };
436 CONST_OID aes128_CBC[] = { AES, 2 };
437 #ifdef DEFINE_ALL_AES_CIPHERS
438 CONST_OID aes128_OFB[] = { AES, 3 };
439 CONST_OID aes128_CFB[] = { AES, 4 };
440 #endif
441 CONST_OID aes128_KEY_WRAP[] = { AES, 5 };
442
443 CONST_OID aes192_ECB[] = { AES, 21 };
444 CONST_OID aes192_CBC[] = { AES, 22 };
445 #ifdef DEFINE_ALL_AES_CIPHERS
446 CONST_OID aes192_OFB[] = { AES, 23 };
447 CONST_OID aes192_CFB[] = { AES, 24 };
448 #endif
449 CONST_OID aes192_KEY_WRAP[] = { AES, 25 };
450
451 CONST_OID aes256_ECB[] = { AES, 41 };
452 CONST_OID aes256_CBC[] = { AES, 42 };
453 #ifdef DEFINE_ALL_AES_CIPHERS
454 CONST_OID aes256_OFB[] = { AES, 43 };
455 CONST_OID aes256_CFB[] = { AES, 44 };
456 #endif
457 CONST_OID aes256_KEY_WRAP[] = { AES, 45 };
458
459 CONST_OID sha256[] = { SHAXXX, 1 };
460 CONST_OID sha384[] = { SHAXXX, 2 };
461 CONST_OID sha512[] = { SHAXXX, 3 };
462 CONST_OID sha224[] = { SHAXXX, 4 };
463
464 CONST_OID ecdsaWithSHA1[] = { ANSI_X9_62_SIG_TYPE, 1 };
465 CONST_OID ecdsaWithSHA256[] = { ECDSA_WITH_SHA2, 2 };
466 CONST_OID ecdsaWithSHA384[] = { ECDSA_WITH_SHA2, 3 };
467 CONST_OID ecdsaWithSHA512[] = { ECDSA_WITH_SHA2, 4 };
468 CONST_OID ecPublicKey[] = { ANSI_X9_62_PUBKEY_TYPE, 1 };
469 /* This OID doesn't appear in a CMS msg */
470 __unused CONST_OID ecdsaSig[] = { ANSI_X9_62_SIG_TYPE };
471
472 /* ECDH curves */
473 CONST_OID secp256r1[] = { 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07 };
474 CONST_OID secp384r1[] = { CERTICOM_ELL_CURVE, 0x22 };
475 CONST_OID secp521r1[] = { CERTICOM_ELL_CURVE, 0x23 };
476
477 /* RFC 3278 */
478 CONST_OID dhSinglePassStdDHsha1kdf[] = {ANSI_X9_63_SCHEME, 2 };
479 __unused CONST_OID dhSinglePassCofactorDHsha1kdf[] = {ANSI_X9_63_SCHEME, 3 };
480 __unused CONST_OID mqvSinglePassSha1kdf[] = {ANSI_X9_63_SCHEME, 4 };
481
482 /* Apple Hash Agility */
483 CONST_OID appleHashAgility[] = {APPLE_CMS_ATTRIBUTES, 1};
484 CONST_OID appleHashAgilityV2[] = {APPLE_CMS_ATTRIBUTES, 2};
485
486 /* Apple Expiration Time */
487 CONST_OID appleExpirationTime[] = {APPLE_CMS_ATTRIBUTES, 3};
488
489 /* a special case: always associated with a caller-specified OID */
490 CONST_OID noOid[] = { 0 };
491
492 #define OI(x) { sizeof x, (uint8_t *)x }
493 #ifndef SECOID_NO_STRINGS
494 #if USE_CDSA_CRYPTO
495 #define OD(oid,tag,desc,mech,ext) { OI(oid), tag, desc, mech, ext }
496 #else
497 #define OD(oid,tag,desc,mech,ext) { OI(oid), tag, desc, ext }
498 #endif
499 #else
500 #define OD(oid,tag,desc,mech,ext) { OI(oid), tag, 0, mech, ext }
501 #endif
502
503 /*
504 NOTE: the order of these entries must match the SECOidTag enum in secoidt.h!
505 @@@ We are sticking a enum type in a field of type SecAsn1AlgId, which is
506 defined as:
507 typedef struct {
508 SecAsn1Oid algorithm;
509 SecAsn1Item parameters;
510 } SecAsn1AlgId;
511 */
512 static const SECOidData oids[] = {
513 OD( null_oid, SEC_OID_UNKNOWN, "Unknown OID", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
514 OD( md2, SEC_OID_MD2, "MD2", CSSM_ALGID_MD2, INVALID_CERT_EXTENSION ),
515 OD( md4, SEC_OID_MD4, "MD4", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
516 OD( md5, SEC_OID_MD5, "MD5", CSSM_ALGID_MD5, INVALID_CERT_EXTENSION ),
517 OD( sha1, SEC_OID_SHA1, "SHA-1", CSSM_ALGID_SHA1, INVALID_CERT_EXTENSION ),
518 OD( rc2cbc, SEC_OID_RC2_CBC,
519 "RC2-CBC", CSSM_ALGID_RC2, INVALID_CERT_EXTENSION ),
520 OD( rc4, SEC_OID_RC4, "RC4", CSSM_ALGID_RC4, INVALID_CERT_EXTENSION ),
521 OD( desede3cbc, SEC_OID_DES_EDE3_CBC,
522 "DES-EDE3-CBC", CSSM_ALGID_3DES_3KEY_EDE, INVALID_CERT_EXTENSION ),
523 OD( rc5cbcpad, SEC_OID_RC5_CBC_PAD,
524 "RC5-CBCPad", CSSM_ALGID_RC5, INVALID_CERT_EXTENSION ),
525 OD( desecb, SEC_OID_DES_ECB,
526 "DES-ECB", CSSM_ALGID_DES, INVALID_CERT_EXTENSION ),
527 OD( descbc, SEC_OID_DES_CBC,
528 "DES-CBC", CSSM_ALGID_DES, INVALID_CERT_EXTENSION ),
529 OD( desofb, SEC_OID_DES_OFB,
530 "DES-OFB", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
531 OD( descfb, SEC_OID_DES_CFB,
532 "DES-CFB", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
533 OD( desmac, SEC_OID_DES_MAC,
534 "DES-MAC", CSSM_ALGID_DES, INVALID_CERT_EXTENSION ),
535 OD( desede, SEC_OID_DES_EDE,
536 "DES-EDE", CSSM_ALGID_3DES_3KEY_EDE, INVALID_CERT_EXTENSION ),
537 OD( isoSHAWithRSASignature, SEC_OID_ISO_SHA_WITH_RSA_SIGNATURE,
538 "ISO SHA with RSA Signature",
539 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
540 OD( pkcs1RSAEncryption, SEC_OID_PKCS1_RSA_ENCRYPTION,
541 "PKCS #1 RSA Encryption", CSSM_ALGID_RSA, INVALID_CERT_EXTENSION ),
542
543 /* the following Signing CSSM_ALGORITHMS should get new CKM_ values when
544 * values for CKM_RSA_WITH_MDX and CKM_RSA_WITH_SHA_1 get defined in
545 * PKCS #11.
546 */
547 OD( pkcs1MD2WithRSAEncryption, SEC_OID_PKCS1_MD2_WITH_RSA_ENCRYPTION,
548 "PKCS #1 MD2 With RSA Encryption", CSSM_ALGID_MD2WithRSA,
549 INVALID_CERT_EXTENSION ),
550 OD( pkcs1MD4WithRSAEncryption, SEC_OID_PKCS1_MD4_WITH_RSA_ENCRYPTION,
551 "PKCS #1 MD4 With RSA Encryption",
552 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
553 OD( pkcs1MD5WithRSAEncryption, SEC_OID_PKCS1_MD5_WITH_RSA_ENCRYPTION,
554 "PKCS #1 MD5 With RSA Encryption", CSSM_ALGID_MD5WithRSA,
555 INVALID_CERT_EXTENSION ),
556 OD( pkcs1SHA1WithRSAEncryption, SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION,
557 "PKCS #1 SHA-1 With RSA Encryption", CSSM_ALGID_SHA1WithRSA,
558 INVALID_CERT_EXTENSION ),
559
560 OD( pkcs5PbeWithMD2AndDEScbc, SEC_OID_PKCS5_PBE_WITH_MD2_AND_DES_CBC,
561 "PKCS #5 Password Based Encryption with MD2 and DES CBC",
562 CSSM_ALGID_PKCS5_PBKDF1_MD2, INVALID_CERT_EXTENSION ),
563 OD( pkcs5PbeWithMD5AndDEScbc, SEC_OID_PKCS5_PBE_WITH_MD5_AND_DES_CBC,
564 "PKCS #5 Password Based Encryption with MD5 and DES CBC",
565 CSSM_ALGID_PKCS5_PBKDF1_MD5, INVALID_CERT_EXTENSION ),
566 OD( pkcs5PbeWithSha1AndDEScbc, SEC_OID_PKCS5_PBE_WITH_SHA1_AND_DES_CBC,
567 "PKCS #5 Password Based Encryption with SHA1 and DES CBC",
568 CSSM_ALGID_PKCS5_PBKDF1_SHA1, INVALID_CERT_EXTENSION ),
569 OD( pkcs7, SEC_OID_PKCS7,
570 "PKCS #7", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
571 OD( pkcs7Data, SEC_OID_PKCS7_DATA,
572 "PKCS #7 Data", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
573 OD( pkcs7SignedData, SEC_OID_PKCS7_SIGNED_DATA,
574 "PKCS #7 Signed Data", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
575 OD( pkcs7EnvelopedData, SEC_OID_PKCS7_ENVELOPED_DATA,
576 "PKCS #7 Enveloped Data",
577 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
578 OD( pkcs7SignedEnvelopedData, SEC_OID_PKCS7_SIGNED_ENVELOPED_DATA,
579 "PKCS #7 Signed And Enveloped Data",
580 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
581 OD( pkcs7DigestedData, SEC_OID_PKCS7_DIGESTED_DATA,
582 "PKCS #7 Digested Data",
583 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
584 OD( pkcs7EncryptedData, SEC_OID_PKCS7_ENCRYPTED_DATA,
585 "PKCS #7 Encrypted Data",
586 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
587 OD( pkcs9EmailAddress, SEC_OID_PKCS9_EMAIL_ADDRESS,
588 "PKCS #9 Email Address",
589 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
590 OD( pkcs9UnstructuredName, SEC_OID_PKCS9_UNSTRUCTURED_NAME,
591 "PKCS #9 Unstructured Name",
592 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
593 OD( pkcs9ContentType, SEC_OID_PKCS9_CONTENT_TYPE,
594 "PKCS #9 Content Type",
595 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
596 OD( pkcs9MessageDigest, SEC_OID_PKCS9_MESSAGE_DIGEST,
597 "PKCS #9 Message Digest",
598 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
599 OD( pkcs9SigningTime, SEC_OID_PKCS9_SIGNING_TIME,
600 "PKCS #9 Signing Time",
601 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
602 OD( pkcs9CounterSignature, SEC_OID_PKCS9_COUNTER_SIGNATURE,
603 "PKCS #9 Counter Signature",
604 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
605 OD( pkcs9ChallengePassword, SEC_OID_PKCS9_CHALLENGE_PASSWORD,
606 "PKCS #9 Challenge Password",
607 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
608 OD( pkcs9UnstructuredAddress, SEC_OID_PKCS9_UNSTRUCTURED_ADDRESS,
609 "PKCS #9 Unstructured Address",
610 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
611 OD( pkcs9ExtendedCertificateAttributes,
612 SEC_OID_PKCS9_EXTENDED_CERTIFICATE_ATTRIBUTES,
613 "PKCS #9 Extended Certificate Attributes",
614 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
615 OD( pkcs9SMIMECapabilities, SEC_OID_PKCS9_SMIME_CAPABILITIES,
616 "PKCS #9 S/MIME Capabilities",
617 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
618 OD( x520CommonName, SEC_OID_AVA_COMMON_NAME,
619 "X520 Common Name", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
620 OD( x520CountryName, SEC_OID_AVA_COUNTRY_NAME,
621 "X520 Country Name", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
622 OD( x520LocalityName, SEC_OID_AVA_LOCALITY,
623 "X520 Locality Name", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
624 OD( x520StateOrProvinceName, SEC_OID_AVA_STATE_OR_PROVINCE,
625 "X520 State Or Province Name",
626 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
627 OD( x520OrgName, SEC_OID_AVA_ORGANIZATION_NAME,
628 "X520 Organization Name",
629 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
630 OD( x520OrgUnitName, SEC_OID_AVA_ORGANIZATIONAL_UNIT_NAME,
631 "X520 Organizational Unit Name",
632 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
633 OD( x520DnQualifier, SEC_OID_AVA_DN_QUALIFIER,
634 "X520 DN Qualifier", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
635 OD( rfc2247DomainComponent, SEC_OID_AVA_DC,
636 "RFC 2247 Domain Component",
637 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
638
639 OD( nsTypeGIF, SEC_OID_NS_TYPE_GIF,
640 "GIF", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
641 OD( nsTypeJPEG, SEC_OID_NS_TYPE_JPEG,
642 "JPEG", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
643 OD( nsTypeURL, SEC_OID_NS_TYPE_URL,
644 "URL", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
645 OD( nsTypeHTML, SEC_OID_NS_TYPE_HTML,
646 "HTML", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
647 OD( nsTypeCertSeq, SEC_OID_NS_TYPE_CERT_SEQUENCE,
648 "Certificate Sequence",
649 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
650 OD( missiCertKEADSSOld, SEC_OID_MISSI_KEA_DSS_OLD,
651 "MISSI KEA and DSS Algorithm (Old)",
652 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
653 OD( missiCertDSSOld, SEC_OID_MISSI_DSS_OLD,
654 "MISSI DSS Algorithm (Old)",
655 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
656 OD( missiCertKEADSS, SEC_OID_MISSI_KEA_DSS,
657 "MISSI KEA and DSS Algorithm",
658 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
659 OD( missiCertDSS, SEC_OID_MISSI_DSS,
660 "MISSI DSS Algorithm",
661 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
662 OD( missiCertKEA, SEC_OID_MISSI_KEA,
663 "MISSI KEA Algorithm",
664 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
665 OD( missiCertAltKEA, SEC_OID_MISSI_ALT_KEA,
666 "MISSI Alternate KEA Algorithm",
667 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
668
669 /* Netscape private extensions */
670 OD( nsCertExtNetscapeOK, SEC_OID_NS_CERT_EXT_NETSCAPE_OK,
671 "Netscape says this cert is OK",
672 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
673 OD( nsCertExtIssuerLogo, SEC_OID_NS_CERT_EXT_ISSUER_LOGO,
674 "Certificate Issuer Logo",
675 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
676 OD( nsCertExtSubjectLogo, SEC_OID_NS_CERT_EXT_SUBJECT_LOGO,
677 "Certificate Subject Logo",
678 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
679 OD( nsExtCertType, SEC_OID_NS_CERT_EXT_CERT_TYPE,
680 "Certificate Type",
681 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
682 OD( nsExtBaseURL, SEC_OID_NS_CERT_EXT_BASE_URL,
683 "Certificate Extension Base URL",
684 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
685 OD( nsExtRevocationURL, SEC_OID_NS_CERT_EXT_REVOCATION_URL,
686 "Certificate Revocation URL",
687 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
688 OD( nsExtCARevocationURL, SEC_OID_NS_CERT_EXT_CA_REVOCATION_URL,
689 "Certificate Authority Revocation URL",
690 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
691 OD( nsExtCACRLURL, SEC_OID_NS_CERT_EXT_CA_CRL_URL,
692 "Certificate Authority CRL Download URL",
693 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
694 OD( nsExtCACertURL, SEC_OID_NS_CERT_EXT_CA_CERT_URL,
695 "Certificate Authority Certificate Download URL",
696 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
697 OD( nsExtCertRenewalURL, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_URL,
698 "Certificate Renewal URL",
699 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
700 OD( nsExtCAPolicyURL, SEC_OID_NS_CERT_EXT_CA_POLICY_URL,
701 "Certificate Authority Policy URL",
702 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
703 OD( nsExtHomepageURL, SEC_OID_NS_CERT_EXT_HOMEPAGE_URL,
704 "Certificate Homepage URL",
705 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
706 OD( nsExtEntityLogo, SEC_OID_NS_CERT_EXT_ENTITY_LOGO,
707 "Certificate Entity Logo",
708 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
709 OD( nsExtUserPicture, SEC_OID_NS_CERT_EXT_USER_PICTURE,
710 "Certificate User Picture",
711 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
712 OD( nsExtSSLServerName, SEC_OID_NS_CERT_EXT_SSL_SERVER_NAME,
713 "Certificate SSL Server Name",
714 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
715 OD( nsExtComment, SEC_OID_NS_CERT_EXT_COMMENT,
716 "Certificate Comment",
717 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
718 OD( nsExtLostPasswordURL, SEC_OID_NS_CERT_EXT_LOST_PASSWORD_URL,
719 "Lost Password URL",
720 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
721 OD( nsExtCertRenewalTime, SEC_OID_NS_CERT_EXT_CERT_RENEWAL_TIME,
722 "Certificate Renewal Time",
723 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
724 OD( nsKeyUsageGovtApproved, SEC_OID_NS_KEY_USAGE_GOVT_APPROVED,
725 "Strong Crypto Export Approved",
726 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
727
728
729 /* x.509 v3 certificate extensions */
730 OD( x509SubjectDirectoryAttr, SEC_OID_X509_SUBJECT_DIRECTORY_ATTR,
731 "Certificate Subject Directory Attributes",
732 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION),
733 OD( x509SubjectKeyID, SEC_OID_X509_SUBJECT_KEY_ID,
734 "Certificate Subject Key ID",
735 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
736 OD( x509KeyUsage, SEC_OID_X509_KEY_USAGE,
737 "Certificate Key Usage",
738 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
739 OD( x509PrivateKeyUsagePeriod, SEC_OID_X509_PRIVATE_KEY_USAGE_PERIOD,
740 "Certificate Private Key Usage Period",
741 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
742 OD( x509SubjectAltName, SEC_OID_X509_SUBJECT_ALT_NAME,
743 "Certificate Subject Alt Name",
744 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
745 OD( x509IssuerAltName, SEC_OID_X509_ISSUER_ALT_NAME,
746 "Certificate Issuer Alt Name",
747 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
748 OD( x509BasicConstraints, SEC_OID_X509_BASIC_CONSTRAINTS,
749 "Certificate Basic Constraints",
750 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
751 OD( x509NameConstraints, SEC_OID_X509_NAME_CONSTRAINTS,
752 "Certificate Name Constraints",
753 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
754 OD( x509CRLDistPoints, SEC_OID_X509_CRL_DIST_POINTS,
755 "CRL Distribution Points",
756 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
757 OD( x509CertificatePolicies, SEC_OID_X509_CERTIFICATE_POLICIES,
758 "Certificate Policies",
759 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
760 OD( x509PolicyMappings, SEC_OID_X509_POLICY_MAPPINGS,
761 "Certificate Policy Mappings",
762 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
763 OD( x509PolicyConstraints, SEC_OID_X509_POLICY_CONSTRAINTS,
764 "Certificate Policy Constraints",
765 CSSM_ALGID_NONE, UNSUPPORTED_CERT_EXTENSION ),
766 OD( x509AuthKeyID, SEC_OID_X509_AUTH_KEY_ID,
767 "Certificate Authority Key Identifier",
768 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
769 OD( x509ExtKeyUsage, SEC_OID_X509_EXT_KEY_USAGE,
770 "Extended Key Usage",
771 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
772 OD( x509AuthInfoAccess, SEC_OID_X509_AUTH_INFO_ACCESS,
773 "Authority Information Access",
774 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
775
776 /* x.509 v3 CRL extensions */
777 OD( x509CrlNumber, SEC_OID_X509_CRL_NUMBER,
778 "CRL Number", CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
779 OD( x509ReasonCode, SEC_OID_X509_REASON_CODE,
780 "CRL reason code", CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
781 OD( x509InvalidDate, SEC_OID_X509_INVALID_DATE,
782 "Invalid Date", CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
783 OD( x500RSAEncryption, SEC_OID_X500_RSA_ENCRYPTION,
784 "X500 RSA Encryption", CSSM_ALGID_RSA, INVALID_CERT_EXTENSION ),
785 /* added for alg 1485 */
786 OD( rfc1274Uid, SEC_OID_RFC1274_UID,
787 "RFC1274 User Id", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
788 OD( rfc1274Mail, SEC_OID_RFC1274_MAIL,
789 "RFC1274 E-mail Address",
790 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
791
792 /* pkcs 12 additions */
793 OD( pkcs12, SEC_OID_PKCS12,
794 "PKCS #12", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
795 OD( pkcs12ModeIDs, SEC_OID_PKCS12_MODE_IDS,
796 "PKCS #12 Mode IDs", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
797 OD( pkcs12ESPVKIDs, SEC_OID_PKCS12_ESPVK_IDS,
798 "PKCS #12 ESPVK IDs", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
799 OD( pkcs12BagIDs, SEC_OID_PKCS12_BAG_IDS,
800 "PKCS #12 Bag IDs", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
801 OD( pkcs12CertBagIDs, SEC_OID_PKCS12_CERT_BAG_IDS,
802 "PKCS #12 Cert Bag IDs",
803 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
804 OD( pkcs12OIDs, SEC_OID_PKCS12_OIDS,
805 "PKCS #12 OIDs", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
806 OD( pkcs12PBEIDs, SEC_OID_PKCS12_PBE_IDS,
807 "PKCS #12 PBE IDs", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
808 OD( pkcs12SignatureIDs, SEC_OID_PKCS12_SIGNATURE_IDS,
809 "PKCS #12 Signature IDs",
810 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
811 OD( pkcs12EnvelopingIDs, SEC_OID_PKCS12_ENVELOPING_IDS,
812 "PKCS #12 Enveloping IDs",
813 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
814 OD( pkcs12PKCS8KeyShrouding, SEC_OID_PKCS12_PKCS8_KEY_SHROUDING,
815 "PKCS #12 Key Shrouding",
816 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
817 OD( pkcs12KeyBagID, SEC_OID_PKCS12_KEY_BAG_ID,
818 "PKCS #12 Key Bag ID",
819 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
820 OD( pkcs12CertAndCRLBagID, SEC_OID_PKCS12_CERT_AND_CRL_BAG_ID,
821 "PKCS #12 Cert And CRL Bag ID",
822 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
823 OD( pkcs12SecretBagID, SEC_OID_PKCS12_SECRET_BAG_ID,
824 "PKCS #12 Secret Bag ID",
825 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
826 OD( pkcs12X509CertCRLBag, SEC_OID_PKCS12_X509_CERT_CRL_BAG,
827 "PKCS #12 X509 Cert CRL Bag",
828 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
829 OD( pkcs12SDSICertBag, SEC_OID_PKCS12_SDSI_CERT_BAG,
830 "PKCS #12 SDSI Cert Bag",
831 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
832 OD( pkcs12PBEWithSha1And128BitRC4,
833 SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC4,
834 "PKCS #12 PBE With Sha1 and 128 Bit RC4",
835 CSSM_ALGID_PKCS12_SHA1_PBE, INVALID_CERT_EXTENSION ),
836 OD( pkcs12PBEWithSha1And40BitRC4,
837 SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC4,
838 "PKCS #12 PBE With Sha1 and 40 Bit RC4",
839 CSSM_ALGID_PKCS12_SHA1_PBE, INVALID_CERT_EXTENSION ),
840 OD( pkcs12PBEWithSha1AndTripleDESCBC,
841 SEC_OID_PKCS12_PBE_WITH_SHA1_AND_TRIPLE_DES_CBC,
842 "PKCS #12 PBE With Sha1 and Triple DES CBC",
843 CSSM_ALGID_PKCS12_SHA1_PBE, INVALID_CERT_EXTENSION ),
844 OD( pkcs12PBEWithSha1And128BitRC2CBC,
845 SEC_OID_PKCS12_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC,
846 "PKCS #12 PBE With Sha1 and 128 Bit RC2 CBC",
847 CSSM_ALGID_PKCS12_SHA1_PBE, INVALID_CERT_EXTENSION ),
848 OD( pkcs12PBEWithSha1And40BitRC2CBC,
849 SEC_OID_PKCS12_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC,
850 "PKCS #12 PBE With Sha1 and 40 Bit RC2 CBC",
851 CSSM_ALGID_PKCS12_SHA1_PBE, INVALID_CERT_EXTENSION ),
852 OD( pkcs12RSAEncryptionWith128BitRC4,
853 SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_128_BIT_RC4,
854 "PKCS #12 RSA Encryption with 128 Bit RC4",
855 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
856 OD( pkcs12RSAEncryptionWith40BitRC4,
857 SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_40_BIT_RC4,
858 "PKCS #12 RSA Encryption with 40 Bit RC4",
859 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
860 OD( pkcs12RSAEncryptionWithTripleDES,
861 SEC_OID_PKCS12_RSA_ENCRYPTION_WITH_TRIPLE_DES,
862 "PKCS #12 RSA Encryption with Triple DES",
863 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
864 OD( pkcs12RSASignatureWithSHA1Digest,
865 SEC_OID_PKCS12_RSA_SIGNATURE_WITH_SHA1_DIGEST,
866 "PKCS #12 RSA Encryption with Triple DES",
867 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
868
869 /* DSA signatures */
870 OD( ansix9DSASignature, SEC_OID_ANSIX9_DSA_SIGNATURE,
871 "ANSI X9.57 DSA Signature", CSSM_ALGID_DSA, INVALID_CERT_EXTENSION ),
872 OD( ansix9DSASignaturewithSHA1Digest,
873 SEC_OID_ANSIX9_DSA_SIGNATURE_WITH_SHA1_DIGEST,
874 "ANSI X9.57 DSA Signature with SHA1 Digest",
875 CSSM_ALGID_SHA1WithDSA, INVALID_CERT_EXTENSION ),
876 OD( bogusDSASignaturewithSHA1Digest,
877 SEC_OID_BOGUS_DSA_SIGNATURE_WITH_SHA1_DIGEST,
878 "FORTEZZA DSA Signature with SHA1 Digest",
879 CSSM_ALGID_SHA1WithDSA, INVALID_CERT_EXTENSION ),
880
881 /* verisign oids */
882 OD( verisignUserNotices, SEC_OID_VERISIGN_USER_NOTICES,
883 "Verisign User Notices",
884 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
885
886 /* pkix oids */
887 OD( pkixCPSPointerQualifier, SEC_OID_PKIX_CPS_POINTER_QUALIFIER,
888 "PKIX CPS Pointer Qualifier",
889 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
890 OD( pkixUserNoticeQualifier, SEC_OID_PKIX_USER_NOTICE_QUALIFIER,
891 "PKIX User Notice Qualifier",
892 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
893
894 OD( pkixOCSP, SEC_OID_PKIX_OCSP,
895 "PKIX Online Certificate Status Protocol",
896 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
897 OD( pkixOCSPBasicResponse, SEC_OID_PKIX_OCSP_BASIC_RESPONSE,
898 "OCSP Basic Response", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
899 OD( pkixOCSPNonce, SEC_OID_PKIX_OCSP_NONCE,
900 "OCSP Nonce Extension", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
901 OD( pkixOCSPCRL, SEC_OID_PKIX_OCSP_CRL,
902 "OCSP CRL Reference Extension",
903 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
904 OD( pkixOCSPResponse, SEC_OID_PKIX_OCSP_RESPONSE,
905 "OCSP Response Types Extension",
906 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
907 OD( pkixOCSPNoCheck, SEC_OID_PKIX_OCSP_NO_CHECK,
908 "OCSP No Check Extension",
909 CSSM_ALGID_NONE, SUPPORTED_CERT_EXTENSION ),
910 OD( pkixOCSPArchiveCutoff, SEC_OID_PKIX_OCSP_ARCHIVE_CUTOFF,
911 "OCSP Archive Cutoff Extension",
912 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
913 OD( pkixOCSPServiceLocator, SEC_OID_PKIX_OCSP_SERVICE_LOCATOR,
914 "OCSP Service Locator Extension",
915 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
916
917 OD( pkixRegCtrlRegToken, SEC_OID_PKIX_REGCTRL_REGTOKEN,
918 "PKIX CRMF Registration Control, Registration Token",
919 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
920 OD( pkixRegCtrlAuthenticator, SEC_OID_PKIX_REGCTRL_AUTHENTICATOR,
921 "PKIX CRMF Registration Control, Registration Authenticator",
922 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
923 OD( pkixRegCtrlPKIPubInfo, SEC_OID_PKIX_REGCTRL_PKIPUBINFO,
924 "PKIX CRMF Registration Control, PKI Publication Info",
925 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
926 OD( pkixRegCtrlPKIArchOptions,
927 SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS,
928 "PKIX CRMF Registration Control, PKI Archive Options",
929 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
930 OD( pkixRegCtrlOldCertID, SEC_OID_PKIX_REGCTRL_OLD_CERT_ID,
931 "PKIX CRMF Registration Control, Old Certificate ID",
932 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
933 OD( pkixRegCtrlProtEncKey, SEC_OID_PKIX_REGCTRL_PROTOCOL_ENC_KEY,
934 "PKIX CRMF Registration Control, Protocol Encryption Key",
935 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
936 OD( pkixRegInfoUTF8Pairs, SEC_OID_PKIX_REGINFO_UTF8_PAIRS,
937 "PKIX CRMF Registration Info, UTF8 Pairs",
938 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
939 OD( pkixRegInfoCertReq, SEC_OID_PKIX_REGINFO_CERT_REQUEST,
940 "PKIX CRMF Registration Info, Certificate Request",
941 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
942 OD( pkixExtendedKeyUsageServerAuth,
943 SEC_OID_EXT_KEY_USAGE_SERVER_AUTH,
944 "TLS Web Server Authentication Certificate",
945 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
946 OD( pkixExtendedKeyUsageClientAuth,
947 SEC_OID_EXT_KEY_USAGE_CLIENT_AUTH,
948 "TLS Web Client Authentication Certificate",
949 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
950 OD( pkixExtendedKeyUsageCodeSign, SEC_OID_EXT_KEY_USAGE_CODE_SIGN,
951 "Code Signing Certificate",
952 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
953 OD( pkixExtendedKeyUsageEMailProtect,
954 SEC_OID_EXT_KEY_USAGE_EMAIL_PROTECT,
955 "E-Mail Protection Certificate",
956 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
957 OD( pkixExtendedKeyUsageTimeStamp,
958 SEC_OID_EXT_KEY_USAGE_TIME_STAMP,
959 "Time Stamping Certifcate",
960 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
961 OD( pkixOCSPResponderExtendedKeyUsage, SEC_OID_OCSP_RESPONDER,
962 "OCSP Responder Certificate",
963 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
964
965 /* Netscape Algorithm OIDs */
966
967 OD( netscapeSMimeKEA, SEC_OID_NETSCAPE_SMIME_KEA,
968 "Netscape S/MIME KEA", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
969 /* Skipjack OID -- ### mwelch temporary */
970 OD( skipjackCBC, SEC_OID_FORTEZZA_SKIPJACK,
971 "Skipjack CBC64", CSSM_ALGID_SKIPJACK, INVALID_CERT_EXTENSION ),
972 /* pkcs12 v2 oids */
973 OD( pkcs12V2PBEWithSha1And128BitRC4,
974 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC4,
975 "PKCS12 V2 PBE With SHA1 And 128 Bit RC4",
976 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
977 OD( pkcs12V2PBEWithSha1And40BitRC4,
978 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC4,
979 "PKCS12 V2 PBE With SHA1 And 40 Bit RC4",
980 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
981 OD( pkcs12V2PBEWithSha1And3KeyTripleDEScbc,
982 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_3KEY_TRIPLE_DES_CBC,
983 "PKCS12 V2 PBE With SHA1 And 3KEY Triple DES-cbc",
984 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
985 OD( pkcs12V2PBEWithSha1And2KeyTripleDEScbc,
986 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_2KEY_TRIPLE_DES_CBC,
987 "PKCS12 V2 PBE With SHA1 And 2KEY Triple DES-cbc",
988 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
989 OD( pkcs12V2PBEWithSha1And128BitRC2cbc,
990 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_128_BIT_RC2_CBC,
991 "PKCS12 V2 PBE With SHA1 And 128 Bit RC2 CBC",
992 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
993 OD( pkcs12V2PBEWithSha1And40BitRC2cbc,
994 SEC_OID_PKCS12_V2_PBE_WITH_SHA1_AND_40_BIT_RC2_CBC,
995 "PKCS12 V2 PBE With SHA1 And 40 Bit RC2 CBC",
996 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
997 OD( pkcs12SafeContentsID, SEC_OID_PKCS12_SAFE_CONTENTS_ID,
998 "PKCS #12 Safe Contents ID",
999 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1000 OD( pkcs12PKCS8ShroudedKeyBagID,
1001 SEC_OID_PKCS12_PKCS8_SHROUDED_KEY_BAG_ID,
1002 "PKCS #12 Safe Contents ID",
1003 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1004 OD( pkcs12V1KeyBag, SEC_OID_PKCS12_V1_KEY_BAG_ID,
1005 "PKCS #12 V1 Key Bag",
1006 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1007 OD( pkcs12V1PKCS8ShroudedKeyBag,
1008 SEC_OID_PKCS12_V1_PKCS8_SHROUDED_KEY_BAG_ID,
1009 "PKCS #12 V1 PKCS8 Shrouded Key Bag",
1010 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1011 OD( pkcs12V1CertBag, SEC_OID_PKCS12_V1_CERT_BAG_ID,
1012 "PKCS #12 V1 Cert Bag",
1013 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1014 OD( pkcs12V1CRLBag, SEC_OID_PKCS12_V1_CRL_BAG_ID,
1015 "PKCS #12 V1 CRL Bag",
1016 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1017 OD( pkcs12V1SecretBag, SEC_OID_PKCS12_V1_SECRET_BAG_ID,
1018 "PKCS #12 V1 Secret Bag",
1019 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1020 OD( pkcs12V1SafeContentsBag, SEC_OID_PKCS12_V1_SAFE_CONTENTS_BAG_ID,
1021 "PKCS #12 V1 Safe Contents Bag",
1022 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1023
1024 OD( pkcs9X509Certificate, SEC_OID_PKCS9_X509_CERT,
1025 "PKCS #9 X509 Certificate",
1026 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1027 OD( pkcs9SDSICertificate, SEC_OID_PKCS9_SDSI_CERT,
1028 "PKCS #9 SDSI Certificate",
1029 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1030 OD( pkcs9X509CRL, SEC_OID_PKCS9_X509_CRL,
1031 "PKCS #9 X509 CRL", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1032 OD( pkcs9FriendlyName, SEC_OID_PKCS9_FRIENDLY_NAME,
1033 "PKCS #9 Friendly Name",
1034 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1035 OD( pkcs9LocalKeyID, SEC_OID_PKCS9_LOCAL_KEY_ID,
1036 "PKCS #9 Local Key ID",
1037 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1038 OD( pkcs12KeyUsageAttr, SEC_OID_PKCS12_KEY_USAGE,
1039 "PKCS 12 Key Usage", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1040 OD( dhPublicKey, SEC_OID_X942_DIFFIE_HELMAN_KEY,
1041 "Diffie-Helman Public Key", CSSM_ALGID_DH,
1042 INVALID_CERT_EXTENSION ),
1043 OD( netscapeNickname, SEC_OID_NETSCAPE_NICKNAME,
1044 "Netscape Nickname", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1045
1046 /* Cert Server specific OIDs */
1047 OD( netscapeRecoveryRequest, SEC_OID_NETSCAPE_RECOVERY_REQUEST,
1048 "Recovery Request OID",
1049 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1050
1051 OD( nsExtAIACertRenewal, SEC_OID_CERT_RENEWAL_LOCATOR,
1052 "Certificate Renewal Locator OID", CSSM_ALGID_NONE,
1053 INVALID_CERT_EXTENSION ),
1054
1055 OD( nsExtCertScopeOfUse, SEC_OID_NS_CERT_EXT_SCOPE_OF_USE,
1056 "Certificate Scope-of-Use Extension", CSSM_ALGID_NONE,
1057 SUPPORTED_CERT_EXTENSION ),
1058
1059 /* CMS stuff */
1060 OD( cmsESDH, SEC_OID_CMS_EPHEMERAL_STATIC_DIFFIE_HELLMAN,
1061 "Ephemeral-Static Diffie-Hellman", CSSM_ALGID_NONE /* XXX */,
1062 INVALID_CERT_EXTENSION ),
1063 OD( cms3DESwrap, SEC_OID_CMS_3DES_KEY_WRAP,
1064 "CMS 3DES Key Wrap", CSSM_ALGID_NONE /* XXX */,
1065 INVALID_CERT_EXTENSION ),
1066 OD( cmsRC2wrap, SEC_OID_CMS_RC2_KEY_WRAP,
1067 "CMS RC2 Key Wrap", CSSM_ALGID_NONE /* XXX */,
1068 INVALID_CERT_EXTENSION ),
1069 OD( smimeEncryptionKeyPreference, SEC_OID_SMIME_ENCRYPTION_KEY_PREFERENCE,
1070 "S/MIME Encryption Key Preference",
1071 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1072
1073 /* AES algorithm OIDs */
1074 OD( aes128_ECB, SEC_OID_AES_128_ECB,
1075 "AES-128-ECB", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1076 OD( aes128_CBC, SEC_OID_AES_128_CBC,
1077 "AES-128-CBC", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1078 OD( aes192_ECB, SEC_OID_AES_192_ECB,
1079 "AES-192-ECB", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1080 OD( aes192_CBC, SEC_OID_AES_192_CBC,
1081 "AES-192-CBC", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1082 OD( aes256_ECB, SEC_OID_AES_256_ECB,
1083 "AES-256-ECB", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1084 OD( aes256_CBC, SEC_OID_AES_256_CBC,
1085 "AES-256-CBC", CSSM_ALGID_AES, INVALID_CERT_EXTENSION ),
1086
1087 /* More bogus DSA OIDs */
1088 OD( sdn702DSASignature, SEC_OID_SDN702_DSA_SIGNATURE,
1089 "SDN.702 DSA Signature", CSSM_ALGID_SHA1WithDSA, INVALID_CERT_EXTENSION ),
1090
1091 OD( ms_smimeEncryptionKeyPreference,
1092 SEC_OID_MS_SMIME_ENCRYPTION_KEY_PREFERENCE,
1093 "Microsoft S/MIME Encryption Key Preference",
1094 CSSM_ALGID_NONE, INVALID_CERT_EXTENSION ),
1095
1096 OD( sha224, SEC_OID_SHA224, "SHA-224", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1097 OD( sha256, SEC_OID_SHA256, "SHA-256", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1098 OD( sha384, SEC_OID_SHA384, "SHA-384", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1099 OD( sha512, SEC_OID_SHA512, "SHA-512", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1100
1101 OD( pkcs1SHA256WithRSAEncryption, SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION,
1102 "PKCS #1 SHA-256 With RSA Encryption", CSSM_ALGID_NONE,
1103 INVALID_CERT_EXTENSION ),
1104 OD( pkcs1SHA384WithRSAEncryption, SEC_OID_PKCS1_SHA384_WITH_RSA_ENCRYPTION,
1105 "PKCS #1 SHA-384 With RSA Encryption", CSSM_ALGID_NONE,
1106 INVALID_CERT_EXTENSION ),
1107 OD( pkcs1SHA512WithRSAEncryption, SEC_OID_PKCS1_SHA512_WITH_RSA_ENCRYPTION,
1108 "PKCS #1 SHA-512 With RSA Encryption", CSSM_ALGID_NONE,
1109 INVALID_CERT_EXTENSION ),
1110
1111 OD( aes128_KEY_WRAP, SEC_OID_AES_128_KEY_WRAP,
1112 "AES-128 Key Wrap", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1113 OD( aes192_KEY_WRAP, SEC_OID_AES_192_KEY_WRAP,
1114 "AES-192 Key Wrap", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1115 OD( aes256_KEY_WRAP, SEC_OID_AES_256_KEY_WRAP,
1116 "AES-256 Key Wrap", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1117
1118 /* caller-specified OID for eContentType */
1119 OD( noOid, SEC_OID_OTHER,
1120 "Caller-specified eContentType", CSSM_ALGID_NONE, INVALID_CERT_EXTENSION),
1121
1122 OD( ecPublicKey, SEC_OID_EC_PUBLIC_KEY,
1123 "ECDSA Public Key", CSSM_ALGID_NONE,
1124 INVALID_CERT_EXTENSION ),
1125 OD( ecdsaWithSHA1, SEC_OID_ECDSA_WithSHA1,
1126 "SHA-1 With ECDSA", CSSM_ALGID_NONE,
1127 INVALID_CERT_EXTENSION ),
1128 OD( dhSinglePassStdDHsha1kdf, SEC_OID_DH_SINGLE_STD_SHA1KDF,
1129 "ECDH With SHA1 KDF", CSSM_ALGID_NONE,
1130 INVALID_CERT_EXTENSION ),
1131 OD( secp256r1, SEC_OID_SECP_256_R1,
1132 "secp256r1", CSSM_ALGID_NONE,
1133 INVALID_CERT_EXTENSION ),
1134 OD( secp384r1, SEC_OID_SECP_384_R1,
1135 "secp384r1", CSSM_ALGID_NONE,
1136 INVALID_CERT_EXTENSION ),
1137 OD( secp521r1, SEC_OID_SECP_521_R1,
1138 "secp521r1", CSSM_ALGID_NONE,
1139 INVALID_CERT_EXTENSION ),
1140
1141 OD( smimeTimeStampTokenInfo, SEC_OID_PKCS9_ID_CT_TSTInfo,
1142 "id-ct-TSTInfo", CSSM_ALGID_NONE,
1143 INVALID_CERT_EXTENSION ),
1144
1145 OD( smimeTimeStampToken, SEC_OID_PKCS9_TIMESTAMP_TOKEN,
1146 "id-aa-timeStampToken", CSSM_ALGID_NONE,
1147 INVALID_CERT_EXTENSION ),
1148
1149 OD( smimeSigningCertificate, SEC_OID_PKCS9_SIGNING_CERTIFICATE,
1150 "id-aa-signing-certificate", CSSM_ALGID_NONE,
1151 INVALID_CERT_EXTENSION ),
1152
1153 /* ECDSA with SHA2 */
1154 OD( ecdsaWithSHA256, SEC_OID_ECDSA_WITH_SHA256,
1155 "ECDSA With SHA-256", CSSM_ALGID_SHA256WithECDSA,
1156 INVALID_CERT_EXTENSION ),
1157 OD( ecdsaWithSHA384, SEC_OID_ECDSA_WITH_SHA384,
1158 "ECDSA With SHA-384", CSSM_ALGID_SHA384WithECDSA,
1159 INVALID_CERT_EXTENSION ),
1160 OD( ecdsaWithSHA512, SEC_OID_ECDSA_WITH_SHA512,
1161 "ECDSA With SHA-512", CSSM_ALGID_SHA512WithECDSA,
1162 INVALID_CERT_EXTENSION ),
1163
1164 /* Apple Hash Agility */
1165 OD( appleHashAgility, SEC_OID_APPLE_HASH_AGILITY,
1166 "appleCodesigningHashAgilityAttribute", CSSM_ALGID_NONE,
1167 INVALID_CERT_EXTENSION),
1168 OD( appleHashAgilityV2, SEC_OID_APPLE_HASH_AGILITY_V2,
1169 "appleCodesigningHashAgilityAttributeV2", CSSM_ALGID_NONE,
1170 INVALID_CERT_EXTENSION),
1171
1172 /* Apple Expiration Time */
1173 OD( appleExpirationTime, SEC_OID_APPLE_EXPIRATION_TIME,
1174 "appleExpirationTimeAttribute", CSSM_ALGID_NONE,
1175 INVALID_CERT_EXTENSION),
1176
1177 };
1178
1179 /*
1180 * now the dynamic table. The dynamic table gets build at init time.
1181 * and gets modified if the user loads new crypto modules.
1182 */
1183
1184 #if 0 /* disabled since its not used (the only function that could "add" items was disabled before */
1185
1186 // TODO: protect this: used multi-threaded
1187 static PLHashTable *oid_d_hash = 0;
1188 static SECOidData **secoidDynamicTable = NULL;
1189 static int secoidDynamicTableSize = 0;
1190 static int secoidLastDynamicEntry = 0;
1191 static int secoidLastHashEntry = 0;
1192
1193 static SECStatus
1194 secoid_DynamicRehash(void)
1195 {
1196 SECOidData *oid;
1197 PLHashEntry *entry;
1198 int i;
1199 int last = secoidLastDynamicEntry;
1200
1201 if (!oid_d_hash) {
1202 oid_d_hash = PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare,
1203 PL_CompareValues, NULL, NULL);
1204 }
1205
1206
1207 if ( !oid_d_hash ) {
1208 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1209 return(SECFailure);
1210 }
1211
1212 for ( i = secoidLastHashEntry; i < last; i++ ) {
1213 oid = secoidDynamicTable[i];
1214
1215 entry = PL_HashTableAdd( oid_d_hash, &oid->oid, oid );
1216 if ( entry == NULL ) {
1217 return(SECFailure);
1218 }
1219 }
1220 secoidLastHashEntry = last;
1221 return(SECSuccess);
1222 }
1223
1224
1225
1226 /*
1227 * Lookup a Dynamic OID. Dynamic OID's still change slowly, so it's
1228 * cheaper to rehash the table when it changes than it is to do the loop
1229 * each time. Worry: what about thread safety here? Global Static data with
1230 * no locks.... (sigh).
1231 */
1232 static SECOidData *
1233 secoid_FindDynamic(const SecAsn1Item *key) {
1234 SECOidData *ret = NULL;
1235 if (secoidDynamicTable == NULL) {
1236 /* PORT_SetError! */
1237 return NULL;
1238 }
1239 if (secoidLastHashEntry != secoidLastDynamicEntry) {
1240 SECStatus rv = secoid_DynamicRehash();
1241 if ( rv != SECSuccess ) {
1242 return NULL;
1243 }
1244 }
1245 ret = (SECOidData *)PL_HashTableLookup (oid_d_hash, key);
1246 return ret;
1247
1248 }
1249
1250 static SECOidData *
1251 secoid_FindDynamicByTag(SECOidTag tagnum)
1252 {
1253 int tagNumDiff;
1254
1255 if (secoidDynamicTable == NULL) {
1256 return NULL;
1257 }
1258
1259 if (tagnum < SEC_OID_TOTAL) {
1260 return NULL;
1261 }
1262
1263 tagNumDiff = tagnum - SEC_OID_TOTAL;
1264 if (tagNumDiff >= secoidLastDynamicEntry) {
1265 return NULL;
1266 }
1267
1268 return(secoidDynamicTable[tagNumDiff]);
1269 }
1270
1271 /*
1272 * this routine is definately not thread safe. It is only called out
1273 * of the UI, or at init time. If we want to call it any other time,
1274 * we need to make it thread safe.
1275 */
1276 SECStatus
1277 SECOID_AddEntry(SecAsn1Item *oid, char *description, SecAsn1AlgId cssmAlgorithm) {
1278 SECOidData *oiddp = (SECOidData *)PORT_Alloc(sizeof(SECOidData));
1279 int last = secoidLastDynamicEntry;
1280 int tableSize = secoidDynamicTableSize;
1281 int next = last++;
1282 SECOidData **newTable = secoidDynamicTable;
1283 SECOidData **oldTable = NULL;
1284
1285 if (oid == NULL) {
1286 return SECFailure;
1287 }
1288
1289 /* fill in oid structure */
1290 if (SECITEM_CopyItem(NULL,&oiddp->oid,oid) != SECSuccess) {
1291 PORT_Free(oiddp);
1292 return SECFailure;
1293 }
1294 oiddp->offset = (SECOidTag)(next + SEC_OID_TOTAL);
1295 /* may we should just reference the copy passed to us? */
1296 oiddp->desc = PORT_Strdup(description);
1297 oiddp->cssmAlgorithm = cssmAlgorithm;
1298
1299
1300 if (last > tableSize) {
1301 int oldTableSize = tableSize;
1302 tableSize += 10;
1303 oldTable = newTable;
1304 newTable = (SECOidData **)PORT_ZAlloc(sizeof(SECOidData *)*tableSize);
1305 if (newTable == NULL) {
1306 PORT_Free(oiddp->oid.Data);
1307 PORT_Free(oiddp);
1308 return SECFailure;
1309 }
1310 PORT_Memcpy(newTable,oldTable,sizeof(SECOidData *)*oldTableSize);
1311 PORT_Free(oldTable);
1312 }
1313
1314 newTable[next] = oiddp;
1315 secoidDynamicTable = newTable;
1316 secoidDynamicTableSize = tableSize;
1317 secoidLastDynamicEntry= last;
1318 return SECSuccess;
1319 }
1320 #endif
1321
1322 /* normal static table processing */
1323
1324 /* TODO: MORE GLOBAL DATA */
1325 static pthread_once_t hash_once = PTHREAD_ONCE_INIT;
1326 static PLHashTable *oidhash = NULL;
1327 static PLHashTable *oidmechhash = NULL;
1328
1329 static PLHashNumber
1330 secoid_HashNumber(const void *key)
1331 {
1332 /* This truncate the hash to the lower 32 bits -- probably safe right ??? */
1333 return (PLHashNumber)(PRUword)key;
1334 }
1335
1336
1337 static SECStatus
1338 InitOIDHash(void)
1339 {
1340 PLHashEntry *entry;
1341 const SECOidData *oid;
1342 size_t ix;
1343
1344 oidhash = PL_NewHashTable(0, SECITEM_Hash, SECITEM_HashCompare,
1345 PL_CompareValues, NULL, NULL);
1346 oidmechhash = PL_NewHashTable(0, secoid_HashNumber, PL_CompareValues,
1347 PL_CompareValues, NULL, NULL);
1348
1349 if ( !oidhash || !oidmechhash) {
1350 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1351 PORT_Assert(0); /*This function should never fail. */
1352 return(SECFailure);
1353 }
1354
1355 for ( ix = 0; ix < ( sizeof(oids) / sizeof(SECOidData) ); ix++ ) {
1356 oid = &oids[ix];
1357
1358 PORT_Assert ( oid->offset == ix );
1359
1360 entry = PL_HashTableAdd( oidhash, &oid->oid, (void *)oid );
1361 if ( entry == NULL ) {
1362 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1363 PORT_Assert(0); /*This function should never fail. */
1364 return(SECFailure);
1365 }
1366
1367 #if USE_CDSA_CRYPTO
1368 if ( oid->cssmAlgorithm.algorithm.Length /*CSSM_ALGID_NONE*/ ) {
1369 entry = PL_HashTableAdd( oidmechhash,
1370 (void *)&(oid->cssmAlgorithm), (void *)oid );
1371 if ( entry == NULL ) {
1372 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1373 PORT_Assert(0); /* This function should never fail. */
1374 return(SECFailure);
1375 }
1376 }
1377 #endif
1378 }
1379
1380 PORT_Assert (ix == SEC_OID_TOTAL);
1381
1382 return(SECSuccess);
1383 }
1384
1385 static void InitOIDHashOnce()
1386 {
1387 if (SECSuccess != InitOIDHash())
1388 abort();
1389 }
1390
1391 /* TODO: appears to be the public entry point */
1392 SECOidData *
1393 SECOID_FindOIDByCssmAlgorithm(SecAsn1AlgId cssmAlgorithm)
1394 {
1395 SECOidData *ret;
1396
1397 pthread_once(&hash_once, InitOIDHashOnce);
1398
1399 ret = PL_HashTableLookupConst ( oidmechhash, (void *)&cssmAlgorithm);
1400 if ( ret == NULL ) {
1401 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1402 }
1403
1404 return (ret);
1405 }
1406
1407 /* TODO: appears to be the public entry point */
1408 SECOidData *
1409 SECOID_FindOID(const SecAsn1Item *oid)
1410 {
1411 SECOidData *ret;
1412
1413 pthread_once(&hash_once, InitOIDHashOnce);
1414
1415 ret = PL_HashTableLookupConst ( oidhash, oid );
1416 if ( ret == NULL ) {
1417 #if 0
1418 ret = secoid_FindDynamic(oid);
1419 #endif
1420 if (ret == NULL) {
1421 PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
1422 }
1423 }
1424
1425 return(ret);
1426 }
1427
1428 SECOidTag
1429 SECOID_FindOIDTag(const SecAsn1Item *oid)
1430 {
1431 SECOidData *oiddata;
1432
1433 oiddata = SECOID_FindOID (oid);
1434 if (oiddata == NULL)
1435 return SEC_OID_UNKNOWN;
1436
1437 return oiddata->offset;
1438 }
1439
1440 /* This really should return const. */
1441 SECOidData *
1442 SECOID_FindOIDByTag(SECOidTag tagnum)
1443 {
1444 pthread_once(&hash_once, InitOIDHashOnce);
1445
1446 #if 0
1447 if (tagnum >= SEC_OID_TOTAL) {
1448 return secoid_FindDynamicByTag(tagnum);
1449 }
1450 #else
1451 if (tagnum >= SEC_OID_TOTAL)
1452 return NULL;
1453 #endif
1454
1455 PORT_Assert((unsigned int)tagnum < (sizeof(oids) / sizeof(SECOidData)));
1456 return (SECOidData *)(&oids[tagnum]);
1457 }
1458
1459 Boolean SECOID_KnownCertExtenOID (const SecAsn1Item *extenOid)
1460 {
1461 SECOidData * oidData;
1462
1463 oidData = SECOID_FindOID (extenOid);
1464 if (oidData == (SECOidData *)NULL)
1465 return (PR_FALSE);
1466 return ((oidData->supportedExtension == SUPPORTED_CERT_EXTENSION) ?
1467 PR_TRUE : PR_FALSE);
1468 }
1469
1470
1471 const char *
1472 SECOID_FindOIDTagDescription(SECOidTag tagnum)
1473 {
1474 const SECOidData *oidData = SECOID_FindOIDByTag(tagnum);
1475 return oidData ? oidData->desc : 0;
1476 }
1477
1478 #if 0
1479 /*
1480 * free up the oid tables.
1481 */
1482 SECStatus
1483 SECOID_Shutdown(void)
1484 {
1485 int i;
1486
1487 if (oidhash) {
1488 PL_HashTableDestroy(oidhash);
1489 oidhash = NULL;
1490 }
1491 if (oidmechhash) {
1492 PL_HashTableDestroy(oidmechhash);
1493 oidmechhash = NULL;
1494 }
1495 if (oid_d_hash) {
1496 PL_HashTableDestroy(oid_d_hash);
1497 oid_d_hash = NULL;
1498 }
1499 if (secoidDynamicTable) {
1500 for (i=0; i < secoidLastDynamicEntry; i++) {
1501 PORT_Free(secoidDynamicTable[i]);
1502 }
1503 PORT_Free(secoidDynamicTable);
1504 secoidDynamicTable = NULL;
1505 secoidDynamicTableSize = 0;
1506 secoidLastDynamicEntry = 0;
1507 secoidLastHashEntry = 0;
1508 }
1509 return SECSuccess;
1510 }
1511 #endif