]> git.saurik.com Git - apple/security.git/blob - libsecurity_asn1/lib/oidsalg.c
Security-55163.44.tar.gz
[apple/security.git] / libsecurity_asn1 / lib / oidsalg.c
1 /*
2 * Copyright (c) 2000-2004,2008,2010 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*
25 * oidsalg.c - OIDs defining crypto algorithms
26 */
27
28 #include <stdint.h>
29 #include "SecAsn1Types.h"
30 #include "oidsbase.h"
31
32 static const uint8_t
33 OID_MD2[] = { OID_RSA_HASH, 2 },
34 OID_MD4[] = { OID_RSA_HASH, 4 },
35 OID_MD5[] = { OID_RSA_HASH, 5 },
36 OID_RSAEncryption[] = { OID_PKCS_1, 1 },
37 OID_MD2WithRSA[] = { OID_PKCS_1, 2 },
38 OID_MD4WithRSA[] = { OID_PKCS_1, 3 },
39 OID_MD5WithRSA[] = { OID_PKCS_1, 4 },
40 OID_SHA1WithRSA[] = { OID_PKCS_1, 5 },
41 OID_RSAWithOAEP[] = { OID_PKCS_1, 7 },
42 OID_OAEP_MGF1[] = { OID_PKCS_1, 8 },
43 OID_OAEP_ID_PSPECIFIED[]= { OID_PKCS_1, 9 },
44 OID_SHA224WithRSA[] = { OID_PKCS_1, 14 },
45 OID_SHA256WithRSA[] = { OID_PKCS_1, 11 },
46 OID_SHA384WithRSA[] = { OID_PKCS_1, 12 },
47 OID_SHA512WithRSA[] = { OID_PKCS_1, 13 },
48 OID_PKCS_3_ARC[] = { OID_PKCS_3 },
49 OID_DHKeyAgreement[] = { OID_PKCS_3, 1 },
50 /* BSAFE-specific DSA */
51 OID_OIW_DSA[] = { OID_OIW_ALGORITHM, 12 },
52 OID_OIW_DSAWithSHA1[] = { OID_OIW_ALGORITHM, 27 },
53 /* DSA from CMS */
54 OID_CMS_DSA[] = { 0x2A, 0x86, 0x48, 0xCE, 0x38, 4, 1 },
55 OID_CMS_DSAWithSHA1[] = { 0x2A, 0x86, 0x48, 0xCE, 0x38, 4, 3 },
56 /* DSA from JDK 1.1 */
57 OID_JDK_DSA[] = { 0x2B, 0x0E, 0x03, 0x02, 0x0c },
58 OID_JDK_DSAWithSHA1[] = { 0x2B, 0x0E, 0x03, 0x02, 0x0D },
59
60 OID_OIW_SHA1[] = { OID_OIW_ALGORITHM, 26 },
61 OID_OIW_RSAWithSHA1[] = { OID_OIW_ALGORITHM, 29 },
62 OID_OIW_DES_CBC[] = { OID_OIW_ALGORITHM, 7 },
63
64 OID_SHA224[] = { OID_NIST_HASHALG, 4},
65 OID_SHA256[] = { OID_NIST_HASHALG, 1},
66 OID_SHA384[] = { OID_NIST_HASHALG, 2},
67 OID_SHA512[] = { OID_NIST_HASHALG, 3},
68
69 /* ANSI X9.42 */
70 OID_ANSI_DH_PUB_NUMBER[]= { OID_ANSI_X9_42, 1 },
71 OID_ANSI_DH_STATIC[] = { OID_ANSI_X9_42_SCHEME, 1 },
72 OID_ANSI_DH_EPHEM[] = { OID_ANSI_X9_42_SCHEME, 2 },
73 OID_ANSI_DH_ONE_FLOW[] = { OID_ANSI_X9_42_SCHEME, 3 },
74 OID_ANSI_DH_HYBRID1[] = { OID_ANSI_X9_42_SCHEME, 4 },
75 OID_ANSI_DH_HYBRID2[] = { OID_ANSI_X9_42_SCHEME, 5 },
76 OID_ANSI_DH_HYBRID_ONEFLOW[] = { OID_ANSI_X9_42_SCHEME, 6 },
77 /* sic - enumerated in reverse order in the spec */
78 OID_ANSI_MQV1[] = { OID_ANSI_X9_42_SCHEME, 8 },
79 OID_ANSI_MQV2[] = { OID_ANSI_X9_42_SCHEME, 7 },
80
81 OID_ANSI_DH_STATIC_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 1 },
82 OID_ANSI_DH_EPHEM_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 2 },
83 OID_ANSI_DH_ONE_FLOW_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 3 },
84 OID_ANSI_DH_HYBRID1_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 4 },
85 OID_ANSI_DH_HYBRID2_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 5 },
86 OID_ANSI_DH_HYBRID_ONEFLOW_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 6 },
87 /* sic - enumerated in reverse order in the spec */
88 OID_ANSI_MQV1_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 8 },
89 OID_ANSI_MQV2_SHA1[] = { OID_ANSI_X9_42_NAMED_SCHEME, 7 };
90
91 const SecAsn1Oid
92 CSSMOID_MD2 = {OID_RSA_HASH_LENGTH+1, (uint8_t *)OID_MD2},
93 CSSMOID_MD4 = {OID_RSA_HASH_LENGTH+1, (uint8_t *)OID_MD4},
94 CSSMOID_MD5 = {OID_RSA_HASH_LENGTH+1, (uint8_t *)OID_MD5},
95 CSSMOID_RSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_RSAEncryption},
96 CSSMOID_MD2WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_MD2WithRSA},
97 CSSMOID_MD4WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_MD4WithRSA},
98 CSSMOID_MD5WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_MD5WithRSA},
99 CSSMOID_SHA1WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_SHA1WithRSA},
100 CSSMOID_RSAWithOAEP = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_RSAWithOAEP},
101 CSSMOID_OAEP_MGF1 = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_OAEP_MGF1},
102 CSSMOID_OAEP_ID_PSPECIFIED = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_OAEP_ID_PSPECIFIED},
103 CSSMOID_SHA224WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_SHA224WithRSA},
104 CSSMOID_SHA256WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_SHA256WithRSA},
105 CSSMOID_SHA384WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_SHA384WithRSA},
106 CSSMOID_SHA512WithRSA = {OID_PKCS_1_LENGTH+1, (uint8_t *)OID_SHA512WithRSA},
107 CSSMOID_PKCS3 = {OID_PKCS_3_LENGTH, (uint8_t *)OID_PKCS_3_ARC},
108 CSSMOID_DH = {OID_PKCS_3_LENGTH+1, (uint8_t *)OID_DHKeyAgreement},
109 CSSMOID_DSA = {OID_OIW_ALGORITHM_LENGTH+1, (uint8_t *)OID_OIW_DSA},
110 CSSMOID_DSA_CMS = { 7, (uint8_t *)OID_CMS_DSA},
111 CSSMOID_DSA_JDK = { 5, (uint8_t *)OID_JDK_DSA},
112 CSSMOID_SHA1WithDSA = {OID_OIW_ALGORITHM_LENGTH+1, (uint8_t *)OID_OIW_DSAWithSHA1},
113 CSSMOID_SHA1WithDSA_CMS = { 7, (uint8_t *)OID_CMS_DSAWithSHA1},
114 CSSMOID_SHA1WithDSA_JDK = { 5, (uint8_t *)OID_JDK_DSAWithSHA1},
115 CSSMOID_SHA1 = {OID_OIW_ALGORITHM_LENGTH+1, (uint8_t *)OID_OIW_SHA1},
116 CSSMOID_SHA224 = {OID_NIST_HASHALG_LENGTH+1, (uint8_t *)OID_SHA224},
117 CSSMOID_SHA256 = {OID_NIST_HASHALG_LENGTH+1, (uint8_t *)OID_SHA256},
118 CSSMOID_SHA384 = {OID_NIST_HASHALG_LENGTH+1, (uint8_t *)OID_SHA384},
119 CSSMOID_SHA512 = {OID_NIST_HASHALG_LENGTH+1, (uint8_t *)OID_SHA512},
120 CSSMOID_SHA1WithRSA_OIW = {OID_OIW_ALGORITHM_LENGTH+1, (uint8_t *)OID_OIW_RSAWithSHA1},
121 CSSMOID_DES_CBC = {OID_OIW_ALGORITHM_LENGTH+1, (uint8_t *)OID_OIW_DES_CBC},
122 CSSMOID_ANSI_DH_PUB_NUMBER = {OID_ANSI_X9_42_LEN + 1, (uint8_t *)OID_ANSI_DH_PUB_NUMBER},
123 CSSMOID_ANSI_DH_STATIC = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_DH_STATIC},
124 CSSMOID_ANSI_DH_ONE_FLOW = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_DH_ONE_FLOW},
125 CSSMOID_ANSI_DH_EPHEM = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_DH_EPHEM},
126 CSSMOID_ANSI_DH_HYBRID1 = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_DH_HYBRID1},
127 CSSMOID_ANSI_DH_HYBRID2 = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_DH_HYBRID2},
128 CSSMOID_ANSI_DH_HYBRID_ONEFLOW = {OID_ANSI_X9_42_SCHEME_LEN + 1,
129 (uint8_t *)OID_ANSI_DH_HYBRID_ONEFLOW},
130 CSSMOID_ANSI_MQV1 = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_MQV1},
131 CSSMOID_ANSI_MQV2 = {OID_ANSI_X9_42_SCHEME_LEN + 1, (uint8_t *)OID_ANSI_MQV2},
132 CSSMOID_ANSI_DH_STATIC_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
133 (uint8_t *)OID_ANSI_DH_STATIC_SHA1},
134 CSSMOID_ANSI_DH_ONE_FLOW_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
135 (uint8_t *)OID_ANSI_DH_ONE_FLOW_SHA1},
136 CSSMOID_ANSI_DH_EPHEM_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
137 (uint8_t *)OID_ANSI_DH_EPHEM_SHA1},
138 CSSMOID_ANSI_DH_HYBRID1_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
139 (uint8_t *)OID_ANSI_DH_HYBRID1_SHA1},
140 CSSMOID_ANSI_DH_HYBRID2_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
141 (uint8_t *)OID_ANSI_DH_HYBRID2_SHA1},
142 CSSMOID_ANSI_DH_HYBRID_ONEFLOW_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
143 (uint8_t *)OID_ANSI_DH_HYBRID_ONEFLOW_SHA1},
144 CSSMOID_ANSI_MQV1_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
145 (uint8_t *)OID_ANSI_MQV1_SHA1},
146 CSSMOID_ANSI_MQV2_SHA1 = {OID_ANSI_X9_42_NAMED_SCHEME_LEN + 1,
147 (uint8_t *)OID_ANSI_MQV2_SHA1};
148
149
150 /* iSignTP OBJECT IDENTIFIER ::=
151 * { appleTrustPolicy 1 }
152 * { 1 2 840 113635 100 1 1 }
153 *
154 * BER = 06 09 2A 86 48 86 F7 63 64 01 01
155 */
156 static const uint8_t
157 APPLE_TP_ISIGN[] = {APPLE_TP_OID, 1},
158
159 /* AppleX509Basic OBJECT IDENTIFIER ::=
160 * { appleTrustPolicy 2 }
161 * { 1 2 840 113635 100 1 2 }
162 *
163 * BER = 06 09 2A 86 48 86 F7 63 64 01 01
164 */
165 APPLE_TP_X509_BASIC[] = {APPLE_TP_OID, 2},
166
167 /* AppleSSLPolicy := {appleTrustPolicy 3 } */
168 APPLE_TP_SSL[] = {APPLE_TP_OID, 3},
169
170 /* AppleLocalCertGenPolicy := {appleTrustPolicy 4 } */
171 APPLE_TP_LOCAL_CERT_GEN[] = {APPLE_TP_OID, 4},
172
173 /* AppleCSRGenPolicy := {appleTrustPolicy 5 } */
174 APPLE_TP_CSR_GEN[] = {APPLE_TP_OID, 5},
175
176 /* Apple CRL-based revocation policy := {appleTrustPolicy 6 } */
177 APPLE_TP_REVOCATION_CRL[] = {APPLE_TP_OID, 6},
178
179 /* Apple OCSP-based revocation policy := {appleTrustPolicy 7 } */
180 APPLE_TP_REVOCATION_OCSP[] = {APPLE_TP_OID, 7},
181
182 /* Apple S/MIME trust policy := {appleTrustPolicy 8 } */
183 APPLE_TP_SMIME[] = {APPLE_TP_OID, 8},
184
185 /* Apple EAP trust policy := {appleTrustPolicy 9 } */
186 APPLE_TP_EAP[] = {APPLE_TP_OID, 9},
187
188 /*
189 * NOTE: "Apple Code Signing Policy", CSSMOID_APPLE_TP_CODE_SIGN, was renamed
190 * to "Apple Software Update Signing Policy", CSSMOID_APPLE_TP_SW_UPDATE_SIGNING,
191 * on 8/16/06. For compatibility, we keep the TP_CODE_SIGN OID here until
192 * SoftwareUpdate converts to the new symbol.
193 *
194 * Apple Code Signing Policy := { appleTrustPolicy 10 }
195 * Apple Software Update Signing Policy := { appleTrustPolicy 10 }
196 */
197 APPLE_SW_UPDATE_SIGNING[] = {APPLE_TP_OID, 10},
198 #define APPLE_TP_CODE_SIGN APPLE_SW_UPDATE_SIGNING
199
200 /* Apple IPSec Policy := { appleTrustPolicy 11 } */
201 APPLE_TP_IP_SEC[] = {APPLE_TP_OID, 11},
202
203 /* Apple iChat Policy := { appleTrustPolicy 12 } */
204 APPLE_TP_ICHAT[] = {APPLE_TP_OID, 12},
205
206 /* Apple Resource Signing Policy := { appleTrustPolicy 13 } */
207 APPLE_TP_RESOURCE_SIGN[] = {APPLE_TP_OID, 13},
208
209 /* Apple PKINIT Client Cert Policy := { appleTrustPolicy 14 } */
210 APPLE_TP_PKINIT_CLIENT[] = {APPLE_TP_OID, 14},
211
212 /* Apple PKINIT Server Cert Policy := { appleTrustPolicy 15 } */
213 APPLE_TP_PKINIT_SERVER[] = {APPLE_TP_OID, 15},
214
215 /* Apple Code Signing Cert Policy := { appleTrustPolicy 16 } */
216 APPLE_TP_CODE_SIGNING[] = {APPLE_TP_OID, 16},
217
218 /* Apple Package Signing Cert Policy := { appleTrustPolicy 17 } */
219 APPLE_TP_PACKAGE_SIGNING[] = {APPLE_TP_OID, 17},
220
221 /* AppleID Sharing Cert Policy := { appleTrustPolicy 18 } */
222 APPLE_TP_APPLEID_SHARING[] = {APPLE_TP_OID, 18},
223 /* appleIDValidationPolicy */
224
225 /* Apple MacAppStore receipt verification policy := { appleTrustPolicy 19 } */
226 APPLE_TP_MACAPPSTORE_RECEIPT[] = {APPLE_TP_OID, 19},
227
228 /* Apple Time Stamping Server Cert Policy := { appleTrustPolicy 20 } */
229 APPLE_TP_TIMESTAMPING[] = {APPLE_TP_OID, 20},
230
231 /*
232 * fee OBJECT IDENTIFIER ::=
233 * { appleSecurityAlgorithm 1 }
234 * { 1 2 840 113635 100 2 1 }
235 *
236 * BER = 06 09 2A 86 48 86 F7 63 64 02 01
237 */
238 APPLE_FEE[] = {APPLE_ALG_OID, 1},
239
240 /*
241 * asc OBJECT IDENTIFIER ::=
242 * { appleSecurityAlgorithm 2 }
243 * { 1 2 840 113635 100 2 2 }
244 *
245 * BER = 06 09 2A 86 48 86 F7 63 64 02 02
246 */
247 APPLE_ASC[] = {APPLE_ALG_OID, 2},
248
249 /*
250 * fee_MD5 OBJECT IDENTIFIER ::=
251 * { appleSecurityAlgorithm 3 }
252 * { 1 2 840 113635 100 2 3 }
253 *
254 * BER = 06 09 2A 86 48 86 F7 63 64 02 03
255 */
256 APPLE_FEE_MD5[] = {APPLE_ALG_OID, 3},
257
258 /*
259 * fee_SHA1 OBJECT IDENTIFIER ::=
260 * { appleSecurityAlgorithm 4 }
261 * { 1 2 840 113635 100 2 4 }
262 *
263 * BER = 06 09 2A 86 48 86 F7 63 64 02 04
264 */
265 APPLE_FEE_SHA1[] = {APPLE_ALG_OID, 4},
266
267 /*
268 * feed OBJECT IDENTIFIER ::=
269 * { appleSecurityAlgorithm 5 }
270 * { 1 2 840 113635 100 2 5 }
271 *
272 * BER = 06 09 2A 86 48 86 F7 63 64 02 05
273 */
274 APPLE_FEED[] = {APPLE_ALG_OID, 5},
275
276 /*
277 * feedExp OBJECT IDENTIFIER ::=
278 * { appleSecurityAlgorithm 6 }
279 * { 1 2 840 113635 100 2 6 }
280 *
281 * BER = 06 09 2A 86 48 86 F7 63 64 02 06
282 */
283 APPLE_FEEDEXP[] = {APPLE_ALG_OID, 6},
284
285 /*
286 * AppleECDSA OBJECT IDENTIFIER ::=
287 * { appleSecurityAlgorithm 7 }
288 * { 1 2 840 113635 100 2 7 }
289 *
290 * BER = 06 09 2A 86 48 86 F7 63 64 02 07
291 */
292 APPLE_ECDSA[] = {APPLE_ALG_OID, 7},
293
294 /* .mac cert OIDs */
295 OID_DOTMAC_CERT[] = { APPLE_DOTMAC_CERT_OID },
296 OID_DOTMAC_CERT_REQ[] = { APPLE_DOTMAC_CERT_REQ_OID },
297 OID_DOTMAC_CERT_REQ_IDENTITY[] = { APPLE_DOTMAC_CERT_REQ_OID, 1 }, /* deprecated */
298 OID_DOTMAC_CERT_REQ_EMAIL_SIGN[] = { APPLE_DOTMAC_CERT_REQ_OID, 2 }, /* deprecated */
299 OID_DOTMAC_CERT_REQ_EMAIL_ENCRYPT[] = { APPLE_DOTMAC_CERT_REQ_OID, 3 }, /* deprecated */
300 OID_DOTMAC_CERT_REQ_ARCHIVE_LIST[] = { APPLE_DOTMAC_CERT_REQ_OID, 4 },
301 OID_DOTMAC_CERT_REQ_ARCHIVE_STORE[] = { APPLE_DOTMAC_CERT_REQ_OID, 5 },
302 OID_DOTMAC_CERT_REQ_ARCHIVE_FETCH[] = { APPLE_DOTMAC_CERT_REQ_OID, 6 },
303 OID_DOTMAC_CERT_REQ_ARCHIVE_REMOVE[] = { APPLE_DOTMAC_CERT_REQ_OID, 7 },
304 OID_DOTMAC_CERT_REQ_SHARED_SERVICES[] = { APPLE_DOTMAC_CERT_REQ_OID, 8 }, /* treadstone - Shared Services */
305
306 /* OIDs for specifying OID/values pairs in a cert request */
307 OID_DOTMAC_CERT_REQ_VALUE_USERNAME[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 1 },
308 OID_DOTMAC_CERT_REQ_VALUE_PASSWORD[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 2 },
309 OID_DOTMAC_CERT_REQ_VALUE_HOSTNAME[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 3 },
310 OID_DOTMAC_CERT_REQ_VALUE_RENEW[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 4 },
311 OID_DOTMAC_CERT_REQ_VALUE_ASYNC[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 5 },
312 OID_DOTMAC_CERT_REQ_VALUE_IS_PENDING[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 6 },
313 OID_DOTMAC_CERT_REQ_VALUE_TYPE_ICHAT[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 7 },
314 OID_DOTMAC_CERT_REQ_VALUE_TYPE_SHARED_SERVICE[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 8 },
315 OID_DOTMAC_CERT_REQ_VALUE_TYPE_EMAIL_ENCRYPT[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 9 },
316 OID_DOTMAC_CERT_REQ_VALUE_TYPE_EMAIL_SIGN[] = { APPLE_DOTMAC_CERT_REQ_VALUE_OID, 10 }
317 ;
318
319 const SecAsn1Oid
320
321 CSSMOID_APPLE_ISIGN = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_ISIGN},
322 CSSMOID_APPLE_X509_BASIC = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_X509_BASIC},
323 CSSMOID_APPLE_TP_SSL = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_SSL},
324 CSSMOID_APPLE_TP_LOCAL_CERT_GEN =
325 {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_LOCAL_CERT_GEN},
326 CSSMOID_APPLE_TP_CSR_GEN = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_CSR_GEN},
327 CSSMOID_APPLE_TP_REVOCATION_CRL =
328 {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_REVOCATION_CRL},
329 CSSMOID_APPLE_TP_REVOCATION_OCSP =
330 {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_REVOCATION_OCSP},
331 CSSMOID_APPLE_TP_SMIME = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_SMIME},
332 CSSMOID_APPLE_TP_EAP = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_EAP},
333 /* CSSMOID_APPLE_TP_CODE_SIGN here for temporary compatibility */
334 CSSMOID_APPLE_TP_CODE_SIGN = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_CODE_SIGN},
335 CSSMOID_APPLE_TP_SW_UPDATE_SIGNING = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_SW_UPDATE_SIGNING},
336 CSSMOID_APPLE_TP_IP_SEC = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_IP_SEC},
337 CSSMOID_APPLE_TP_ICHAT = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_ICHAT},
338 CSSMOID_APPLE_TP_RESOURCE_SIGN = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_RESOURCE_SIGN},
339 CSSMOID_APPLE_TP_PKINIT_CLIENT = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_PKINIT_CLIENT},
340 CSSMOID_APPLE_TP_PKINIT_SERVER = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_PKINIT_SERVER},
341 CSSMOID_APPLE_TP_CODE_SIGNING = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_CODE_SIGNING},
342 CSSMOID_APPLE_TP_PACKAGE_SIGNING = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_PACKAGE_SIGNING},
343 CSSMOID_APPLE_TP_MACAPPSTORE_RECEIPT = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_MACAPPSTORE_RECEIPT},
344 CSSMOID_APPLE_TP_APPLEID_SHARING = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_APPLEID_SHARING},
345 CSSMOID_APPLE_TP_TIMESTAMPING = {APPLE_TP_OID_LENGTH+1, (uint8_t *)APPLE_TP_TIMESTAMPING},
346 CSSMOID_APPLE_FEE = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_FEE},
347 CSSMOID_APPLE_ASC = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_ASC},
348 CSSMOID_APPLE_FEE_MD5 = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_FEE_MD5},
349 CSSMOID_APPLE_FEE_SHA1 = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_FEE_SHA1},
350 CSSMOID_APPLE_FEED = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_FEED},
351 CSSMOID_APPLE_FEEDEXP = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_FEEDEXP},
352 CSSMOID_APPLE_ECDSA = {APPLE_ALG_OID_LENGTH+1, (uint8_t *)APPLE_ECDSA},
353 /* .mac cert OIDs */
354 CSSMOID_DOTMAC_CERT = { APPLE_DOTMAC_CERT_OID_LENGTH,
355 (uint8_t *)OID_DOTMAC_CERT },
356 CSSMOID_DOTMAC_CERT_REQ = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH,
357 (uint8_t *)OID_DOTMAC_CERT_REQ },
358 /* This actually used to be for requesting an encrypted iChat cert; deprecated in Leopard */
359 CSSMOID_DOTMAC_CERT_REQ_IDENTITY = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
360 (uint8_t *)OID_DOTMAC_CERT_REQ_IDENTITY},
361 CSSMOID_DOTMAC_CERT_REQ_EMAIL_SIGN = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
362 (uint8_t *)OID_DOTMAC_CERT_REQ_EMAIL_SIGN},
363 CSSMOID_DOTMAC_CERT_REQ_EMAIL_ENCRYPT = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
364 (uint8_t *)OID_DOTMAC_CERT_REQ_EMAIL_ENCRYPT},
365 CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_LIST = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
366 (uint8_t *)OID_DOTMAC_CERT_REQ_ARCHIVE_LIST},
367 CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_STORE = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
368 (uint8_t *)OID_DOTMAC_CERT_REQ_ARCHIVE_STORE},
369 CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_FETCH = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
370 (uint8_t *)OID_DOTMAC_CERT_REQ_ARCHIVE_FETCH},
371 CSSMOID_DOTMAC_CERT_REQ_ARCHIVE_REMOVE = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
372 (uint8_t *)OID_DOTMAC_CERT_REQ_ARCHIVE_REMOVE},
373 CSSMOID_DOTMAC_CERT_REQ_SHARED_SERVICES = { APPLE_DOTMAC_CERT_REQ_OID_LENGTH + 1,
374 (uint8_t *)OID_DOTMAC_CERT_REQ_SHARED_SERVICES},
375 CSSMOID_DOTMAC_CERT_REQ_VALUE_USERNAME = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
376 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_USERNAME},
377 CSSMOID_DOTMAC_CERT_REQ_VALUE_PASSWORD = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
378 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_PASSWORD},
379 CSSMOID_DOTMAC_CERT_REQ_VALUE_HOSTNAME = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
380 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_HOSTNAME},
381 CSSMOID_DOTMAC_CERT_REQ_VALUE_RENEW = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
382 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_RENEW},
383 CSSMOID_DOTMAC_CERT_REQ_VALUE_ASYNC = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
384 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_ASYNC},
385 CSSMOID_DOTMAC_CERT_REQ_VALUE_IS_PENDING = { APPLE_DOTMAC_CERT_REQ_VALUE_OID_LENGTH + 1,
386 (uint8_t *)OID_DOTMAC_CERT_REQ_VALUE_IS_PENDING}
387 ;
388
389 /* PKCS5 algorithms */
390
391 static const uint8_t
392 OID_PKCS5_DIGEST_ALG[] = { OID_RSA_HASH },
393 OID_PKCS5_ENCRYPT_ALG[] = { OID_RSA_ENCRYPT },
394 OID_PKCS5_HMAC_SHA1[] = { OID_RSA_HASH, 7 },
395 OID_PKCS5_pbeWithMD2AndDES[] = { OID_PKCS_5, 1 },
396 OID_PKCS5_pbeWithMD5AndDES[] = { OID_PKCS_5, 3 },
397 OID_PKCS5_pbeWithMD2AndRC2[] = { OID_PKCS_5, 4 },
398 OID_PKCS5_pbeWithMD5AndRC2[] = { OID_PKCS_5, 6 },
399 OID_PKCS5_pbeWithSHA1AndDES[] = { OID_PKCS_5, 10 },
400 OID_PKCS5_pbeWithSHA1AndRC2[] = { OID_PKCS_5, 11 },
401 OID_PKCS5_PBKDF2[] = { OID_PKCS_5, 12 },
402 OID_PKCS5_PBES2[] = { OID_PKCS_5, 13 },
403 OID_PKCS5_PBMAC1[] = { OID_PKCS_5, 14 },
404 OID_PKCS5_RC2_CBC[] = { OID_RSA_ENCRYPT, 2 },
405 OID_PKCS5_DES_EDE3_CBC[] = { OID_RSA_ENCRYPT, 7 },
406 OID_PKCS5_RC5_CBC[] = { OID_RSA_ENCRYPT, 9 };
407
408 const SecAsn1Oid
409 CSSMOID_PKCS5_DIGEST_ALG = { OID_RSA_HASH_LENGTH, (uint8_t *)OID_PKCS5_DIGEST_ALG },
410 CSSMOID_PKCS5_ENCRYPT_ALG = { OID_RSA_ENCRYPT_LENGTH, (uint8_t *)OID_PKCS5_ENCRYPT_ALG },
411 CSSMOID_PKCS5_HMAC_SHA1 = { OID_RSA_HASH_LENGTH+1, (uint8_t *)OID_PKCS5_HMAC_SHA1 },
412 CSSMOID_PKCS5_pbeWithMD2AndDES = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithMD2AndDES },
413 CSSMOID_PKCS5_pbeWithMD5AndDES = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithMD5AndDES },
414 CSSMOID_PKCS5_pbeWithMD2AndRC2 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithMD2AndRC2 },
415 CSSMOID_PKCS5_pbeWithMD5AndRC2 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithMD5AndRC2 },
416 CSSMOID_PKCS5_pbeWithSHA1AndDES = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithSHA1AndDES },
417 CSSMOID_PKCS5_pbeWithSHA1AndRC2 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_pbeWithSHA1AndRC2 },
418 CSSMOID_PKCS5_PBKDF2 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_PBKDF2 },
419 CSSMOID_PKCS5_PBES2 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_PBES2 },
420 CSSMOID_PKCS5_PBMAC1 = { OID_PKCS_5_LENGTH+1, (uint8_t *)OID_PKCS5_PBMAC1 },
421 CSSMOID_PKCS5_RC2_CBC = { OID_RSA_ENCRYPT_LENGTH+1, (uint8_t *)OID_PKCS5_RC2_CBC },
422 CSSMOID_PKCS5_DES_EDE3_CBC = { OID_RSA_ENCRYPT_LENGTH+1, (uint8_t *)OID_PKCS5_DES_EDE3_CBC },
423 CSSMOID_PKCS5_RC5_CBC = { OID_RSA_ENCRYPT_LENGTH+1, (uint8_t *)OID_PKCS5_RC5_CBC };
424
425 /* PKCS12 algorithms */
426 #define OID_PKCS12_PbeIds OID_PKCS_12,1
427 #define OID_PKCS12_PbeIds_Length OID_PKCS_12_LENGTH+1
428
429 static const uint8_t
430 OID_PKCS12_pbeWithSHAAnd128BitRC4[] = { OID_PKCS12_PbeIds, 1 },
431 OID_PKCS12_pbeWithSHAAnd40BitRC4[] = { OID_PKCS12_PbeIds, 2 },
432 OID_PKCS12_pbeWithSHAAnd3Key3DESCBC[] = { OID_PKCS12_PbeIds, 3 },
433 OID_PKCS12_pbeWithSHAAnd2Key3DESCBC[] = { OID_PKCS12_PbeIds, 4 },
434 OID_PKCS12_pbeWithSHAAnd128BitRC2CBC[] ={ OID_PKCS12_PbeIds, 5 },
435 OID_PKCS12_pbewithSHAAnd40BitRC2CBC[] = { OID_PKCS12_PbeIds, 6 };
436
437
438 const SecAsn1Oid
439 CSSMOID_PKCS12_pbeWithSHAAnd128BitRC4 = {OID_PKCS12_PbeIds_Length + 1,
440 (uint8_t *)OID_PKCS12_pbeWithSHAAnd128BitRC4 },
441 CSSMOID_PKCS12_pbeWithSHAAnd40BitRC4 = {OID_PKCS12_PbeIds_Length + 1,
442 (uint8_t *)OID_PKCS12_pbeWithSHAAnd40BitRC4 },
443 CSSMOID_PKCS12_pbeWithSHAAnd3Key3DESCBC = {OID_PKCS12_PbeIds_Length + 1,
444 (uint8_t *)OID_PKCS12_pbeWithSHAAnd3Key3DESCBC },
445 CSSMOID_PKCS12_pbeWithSHAAnd2Key3DESCBC = {OID_PKCS12_PbeIds_Length + 1,
446 (uint8_t *)OID_PKCS12_pbeWithSHAAnd2Key3DESCBC },
447 CSSMOID_PKCS12_pbeWithSHAAnd128BitRC2CBC = {OID_PKCS12_PbeIds_Length + 1,
448 (uint8_t *)OID_PKCS12_pbeWithSHAAnd128BitRC2CBC },
449 CSSMOID_PKCS12_pbewithSHAAnd40BitRC2CBC = {OID_PKCS12_PbeIds_Length + 1,
450 (uint8_t *)OID_PKCS12_pbewithSHAAnd40BitRC2CBC };
451
452 /* ANSI X9.62 and Certicom elliptic curve algorithms */
453 static const uint8_t
454 OID_ecPublicKey[] = { OID_ANSI_X9_62_PUBKEY_TYPE, 1 },
455 OID_ECDSA_WithSHA1[] = { OID_ANSI_X9_62_SIG_TYPE, 1 },
456 OID_ECDSA_WithSHA224[] = { OID_ANSI_X9_62_SIG_TYPE, 3, 1 },
457 OID_ECDSA_WithSHA256[] = { OID_ANSI_X9_62_SIG_TYPE, 3, 2 },
458 OID_ECDSA_WithSHA384[] = { OID_ANSI_X9_62_SIG_TYPE, 3, 3 },
459 OID_ECDSA_WithSHA512[] = { OID_ANSI_X9_62_SIG_TYPE, 3, 4 },
460 OID_ECDSA_WithSpecified[] = { OID_ANSI_X9_62_SIG_TYPE, 3 };
461
462 const SecAsn1Oid
463 CSSMOID_ecPublicKey = {OID_ANSI_X9_62_LEN+2, (uint8_t *)OID_ecPublicKey},
464 CSSMOID_ECDSA_WithSHA1 = {OID_ANSI_X9_62_SIG_TYPE_LEN+1, (uint8_t *)OID_ECDSA_WithSHA1 },
465 CSSMOID_ECDSA_WithSHA224 = {OID_ANSI_X9_62_SIG_TYPE_LEN+2, (uint8_t *)OID_ECDSA_WithSHA224 },
466 CSSMOID_ECDSA_WithSHA256 = {OID_ANSI_X9_62_SIG_TYPE_LEN+2, (uint8_t *)OID_ECDSA_WithSHA256 },
467 CSSMOID_ECDSA_WithSHA384 = {OID_ANSI_X9_62_SIG_TYPE_LEN+2, (uint8_t *)OID_ECDSA_WithSHA384 },
468 CSSMOID_ECDSA_WithSHA512 = {OID_ANSI_X9_62_SIG_TYPE_LEN+2, (uint8_t *)OID_ECDSA_WithSHA512 },
469 CSSMOID_ECDSA_WithSpecified = {OID_ANSI_X9_62_SIG_TYPE_LEN+1, (uint8_t *)OID_ECDSA_WithSpecified };