1/*
2 * Copyright (c) 2005-2009,2011-2014 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/*
26 * oids.c - OID consts
27 *
28 */
29
30#include <libDER/libDER.h>
31#include <libDER/oids.h>
32
33#define OID_ISO_CCITT_DIR_SERVICE 			85
34#define OID_DS              				OID_ISO_CCITT_DIR_SERVICE
35#define OID_ATTR_TYPE        				OID_DS, 4
36#define OID_EXTENSION        				OID_DS, 29
37#define OID_ISO_STANDARD      	 			40
38#define OID_ISO_MEMBER         				42
39#define OID_US                 				OID_ISO_MEMBER, 134, 72
40
41#define OID_ISO_IDENTIFIED_ORG 				43
42#define OID_OSINET             				OID_ISO_IDENTIFIED_ORG, 4
43#define OID_GOSIP              				OID_ISO_IDENTIFIED_ORG, 5
44#define OID_DOD                				OID_ISO_IDENTIFIED_ORG, 6
45#define OID_OIW                				OID_ISO_IDENTIFIED_ORG, 14
46
47/* From the PKCS Standards */
48#define OID_RSA               				OID_US, 134, 247, 13
49#define OID_RSA_HASH          				OID_RSA, 2
50#define OID_RSA_ENCRYPT       				OID_RSA, 3
51#define OID_PKCS             				OID_RSA, 1
52#define OID_PKCS_1          				OID_PKCS, 1
53#define OID_PKCS_2          				OID_PKCS, 2
54#define OID_PKCS_3          				OID_PKCS, 3
55#define OID_PKCS_4          				OID_PKCS, 4
56#define OID_PKCS_5          				OID_PKCS, 5
57#define OID_PKCS_6          				OID_PKCS, 6
58#define OID_PKCS_7          				OID_PKCS, 7
59#define OID_PKCS_8          				OID_PKCS, 8
60#define OID_PKCS_9          				OID_PKCS, 9
61#define OID_PKCS_10         				OID_PKCS, 10
62#define OID_PKCS_11          				OID_PKCS, 11
63#define OID_PKCS_12          				OID_PKCS, 12
64
65/* ANSI X9.62 */
66#define OID_ANSI_X9_62						OID_US, 206, 61
67#define OID_PUBLIC_KEY_TYPE					OID_ANSI_X9_62, 2
68#define OID_EC_SIG_TYPE                     OID_ANSI_X9_62, 4
69#define OID_ECDSA_WITH_SHA2                 OID_EC_SIG_TYPE, 3
70
71/* ANSI X9.42 */
72#define OID_ANSI_X9_42						OID_US, 206, 62, 2
73#define OID_ANSI_X9_42_SCHEME				OID_ANSI_X9_42, 3
74#define OID_ANSI_X9_42_NAMED_SCHEME			OID_ANSI_X9_42, 4
75
76/* DOD IANA Security releated objects. */
77#define OID_IANA                            OID_DOD, 1, 5
78
79/* Kerberos PKINIT */
80#define OID_KERBv5							OID_IANA, 2
81#define OID_KERBv5_PKINIT					OID_KERBv5, 3
82
83/* DOD IANA Mechanisms. */
84#define OID_MECHANISMS						OID_IANA, 5
85
86/* PKIX */
87#define OID_PKIX							OID_MECHANISMS, 7
88#define OID_PE								OID_PKIX, 1
89#define OID_QT								OID_PKIX, 2
90#define OID_KP								OID_PKIX, 3
91#define OID_OTHER_NAME						OID_PKIX, 8
92#define OID_PDA								OID_PKIX, 9
93#define OID_QCS								OID_PKIX, 11
94#define OID_AD								OID_PKIX, 48
95#define OID_AD_OCSP							OID_AD, 1
96#define OID_AD_CAISSUERS                    OID_AD, 2
97
98/* ISAKMP */
99#define OID_ISAKMP							OID_MECHANISMS, 8
100
101/* ETSI */
102#define OID_ETSI							0x04, 0x00
103#define OID_ETSI_QCS						0x04, 0x00, 0x8E, 0x46, 0x01
104
105#define OID_OIW_SECSIG        				OID_OIW, 3
106
107#define OID_OIW_ALGORITHM    				OID_OIW_SECSIG, 2
108
109/* NIST defined digest algorithm arc (2, 16, 840, 1, 101, 3, 4, 2) */
110#define OID_NIST_HASHALG					0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02
111
112/*
113 * Apple-specific OID bases
114 */
115
116/*
117 * apple OBJECT IDENTIFIER ::=
118 * 	{ iso(1) member-body(2) US(840) 113635 }
119 *
120 * BER = 06 06 2A 86 48 86 F7 63
121 */
122#define APPLE_OID				OID_US, 0x86, 0xf7, 0x63
123
124/* appleDataSecurity OBJECT IDENTIFIER ::=
125 *		{ apple 100 }
126 *      { 1 2 840 113635 100 }
127 *
128 * BER = 06 07 2A 86 48 86 F7 63 64
129 */
130#define APPLE_ADS_OID			APPLE_OID, 0x64
131
132/*
133 * appleTrustPolicy OBJECT IDENTIFIER ::=
134 *		{ appleDataSecurity 1 }
135 *      { 1 2 840 113635 100 1 }
136 *
137 * BER = 06 08 2A 86 48 86 F7 63 64 01
138 */
139#define APPLE_TP_OID			APPLE_ADS_OID, 1
140
141/*
142 *	appleSecurityAlgorithm OBJECT IDENTIFIER ::=
143 *		{ appleDataSecurity 2 }
144 *      { 1 2 840 113635 100 2 }
145 *
146 * BER = 06 08 2A 86 48 86 F7 63 64 02
147 */
148#define APPLE_ALG_OID			APPLE_ADS_OID, 2
149
150/*
151 * appleDotMacCertificate OBJECT IDENTIFIER ::=
152 *		{ appleDataSecurity 3 }
153 *      { 1 2 840 113635 100 3 }
154 */
155#define APPLE_DOTMAC_CERT_OID			APPLE_ADS_OID, 3
156
157/*
158 * Basis of Policy OIDs for .mac TP requests
159 *
160 * dotMacCertificateRequest OBJECT IDENTIFIER ::=
161 *		{ appleDotMacCertificate 1 }
162 *      { 1 2 840 113635 100 3 1 }
163 */
164#define APPLE_DOTMAC_CERT_REQ_OID			APPLE_DOTMAC_CERT_OID, 1
165
166/*
167 * Basis of .mac Certificate Extensions
168 *
169 * dotMacCertificateExtension OBJECT IDENTIFIER ::=
170 *		{ appleDotMacCertificate 2 }
171 *      { 1 2 840 113635 100 3 2 }
172 */
173#define APPLE_DOTMAC_CERT_EXTEN_OID			APPLE_DOTMAC_CERT_OID, 2
174
175/*
176 * Basis of .mac Certificate request OID/value identitifiers
177 *
178 * dotMacCertificateRequestValues OBJECT IDENTIFIER ::=
179 *		{ appleDotMacCertificate 3 }
180 *      { 1 2 840 113635 100 3 3 }
181 */
182#define APPLE_DOTMAC_CERT_REQ_VALUE_OID			APPLE_DOTMAC_CERT_OID, 3
183
184/*
185 * Basis of Apple-specific extended key usages
186 *
187 * appleExtendedKeyUsage OBJECT IDENTIFIER ::=
188 *		{ appleDataSecurity 4 }
189 *      { 1 2 840 113635 100 4 }
190 */
191#define APPLE_EKU_OID					APPLE_ADS_OID, 4
192
193/*
194 * Basis of Apple Code Signing extended key usages
195 * appleCodeSigning  OBJECT IDENTIFIER ::=
196 *		{ appleExtendedKeyUsage 1 }
197 *      { 1 2 840 113635 100 4 1}
198 */
199#define APPLE_EKU_CODE_SIGNING			APPLE_EKU_OID, 1
200#define APPLE_EKU_APPLE_ID              APPLE_EKU_OID, 7
201#define APPLE_EKU_SHOEBOX               APPLE_EKU_OID, 14
202#define APPLE_EKU_PROFILE_SIGNING       APPLE_EKU_OID, 16
203#define APPLE_EKU_QA_PROFILE_SIGNING    APPLE_EKU_OID, 17
204
205
206/*
207 * Basis of Apple-specific Certificate Policy IDs.
208 * appleCertificatePolicies OBJECT IDENTIFIER ::=
209 *		{ appleDataSecurity 5 }
210 *		{ 1 2 840 113635 100 5 }
211 */
212#define APPLE_CERT_POLICIES				APPLE_ADS_OID, 5
213
214#define APPLE_CERT_POLICY_MOBILE_STORE	APPLE_CERT_POLICIES, 12
215
216#define APPLE_CERT_POLICY_TEST_MOBILE_STORE APPLE_CERT_POLICY_MOBILE_STORE, 1
217
218/*
219 * Basis of Apple-specific Signing extensions
220 *		{ appleDataSecurity 6 }
221 */
222#define APPLE_CERT_EXT    APPLE_ADS_OID, 6
223
224/* Apple Intermediate Marker OIDs */
225#define APPLE_CERT_EXT_INTERMEDIATE_MARKER APPLE_CERT_EXT, 2
226/* Apple Apple ID Intermediate Marker */
227#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID APPLE_CERT_EXT_INTERMEDIATE_MARKER, 3
228/*
229 *  Apple Apple ID Intermediate Marker (New subCA, no longer shared with push notification server cert issuer
230 *
231 *  appleCertificateExtensionAppleIDIntermediate ::=
232 *    { appleCertificateExtensionIntermediateMarker 7 }
233 *    { 1 2 840 113635 100 6 2 7 }
234 */
235#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_2 APPLE_CERT_EXT_INTERMEDIATE_MARKER, 7
236
237#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_SYSTEM_INTEGRATION_2 APPLE_CERT_EXT_INTERMEDIATE_MARKER, 10
238
239#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_SYSTEM_INTEGRATION_G3 APPLE_CERT_EXT_INTERMEDIATE_MARKER, 13
240
241#define APPLE_CERT_EXT_APPLE_PUSH_MARKER    APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID, 2
242
243
244#define APPLE_CERT_EXTENSION_CODESIGNING        APPLE_CERT_EXT, 1
245
246/* Secure Boot Embedded Image3 value,
247   co-opted by desktop for "Apple Released Code Signature", without value */
248#define APPLE_SBOOT_CERT_EXTEN_SBOOT_SPEC_OID	APPLE_CERT_EXTENSION_CODESIGNING, 1
249/* iPhone Provisioning Profile Signing leaf - on the intermediate marker arc? */
250#define APPLE_PROVISIONING_PROFILE_OID	APPLE_CERT_EXT_INTERMEDIATE_MARKER, 1
251/* iPhone Application Signing leaf */
252#define APPLE_APP_SIGNING_OID          APPLE_CERT_EXTENSION_CODESIGNING, 3
253
254#define APPLE_INSTALLER_PACKAGE_SIGNING_EXTERNAL_OID       APPLE_CERT_EXTENSION_CODESIGNING, 16
255
256#define APPLE_ESCROW_ARC APPLE_CERT_EXT, 23
257
258#define APPLE_ESCROW_POLICY_OID APPLE_ESCROW_ARC, 1
259
260#define APPLE_CERT_EXT_APPLE_ID_VALIDATION_RECORD_SIGNING	APPLE_CERT_EXT, 25
261
262#define APPLE_SERVER_AUTHENTICATION                    APPLE_CERT_EXT, 27
263#define APPLE_CERT_EXT_APPLE_SERVER_AUTHENTICATION     APPLE_SERVER_AUTHENTICATION, 1
264#define APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLE_SERVER_AUTHENTICATION APPLE_CERT_EXT_INTERMEDIATE_MARKER, 12
265
266#define APPLE_CERT_EXT_APPLE_SMP_ENCRYPTION    APPLE_CERT_EXT, 30
267
268/*
269 * Netscape OIDs.
270 */
271#define NETSCAPE_BASE_OID           0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x42
272
273/*
274 * Netscape cert extension.
275 *
276 *  netscape-cert-extension OBJECT IDENTIFIER ::=
277 * 		{ 2 16 840 1 113730 1 }
278 *
279 *	BER = 06 08 60 86 48 01 86 F8 42 01
280 */
281#define NETSCAPE_CERT_EXTEN			NETSCAPE_BASE_OID, 0x01
282
283#define NETSCAPE_CERT_POLICY		NETSCAPE_BASE_OID, 0x04
284
285/* Entrust OIDs. */
286#define ENTRUST_BASE_OID            OID_US, 0x86, 0xf6, 0x7d
287
288/*
289 * Entrust cert extension.
290 *
291 *  entrust-cert-extension OBJECT IDENTIFIER ::=
292 * 		{  1 2 840 113533 7 65 }
293 *
294 *	BER = 06 08 2A 86 48 86 F6 7D 07 41
295 */
296#define ENTRUST_CERT_EXTEN			ENTRUST_BASE_OID, 0x07, 0x41
297
298/* Microsfot OIDs. */
299#define MICROSOFT_BASE_OID          OID_DOD, 0x01, 0x04, 0x01, 0x82, 0x37
300#define MICROSOFT_ENROLLMENT_OID    MICROSOFT_BASE_OID, 0x14
301
302/* Algorithm OIDs. */
303static const DERByte
304    _oidRsa[]                       = { OID_PKCS_1, 1 },
305    _oidMd2Rsa[]                    = { OID_PKCS_1, 2 },
306    _oidMd5Rsa[]                    = { OID_PKCS_1, 4 },
307    _oidSha1Rsa[]                   = { OID_PKCS_1, 5 },
308    _oidSha256Rsa[]                 = { OID_PKCS_1, 11 },
309    _oidEcPubKey[]                  = { OID_PUBLIC_KEY_TYPE, 1 },
310    _oidSha1Ecdsa[]                 = { OID_EC_SIG_TYPE, 1 },     /* rfc3279 */
311    _oidSha224Ecdsa[]               = { OID_ECDSA_WITH_SHA2, 1 }, /* rfc5758 */
312    _oidSha256Ecdsa[]               = { OID_ECDSA_WITH_SHA2, 2 }, /* rfc5758 */
313    _oidSha384Ecdsa[]               = { OID_ECDSA_WITH_SHA2, 3 }, /* rfc5758 */
314    _oidSha512Ecdsa[]               = { OID_ECDSA_WITH_SHA2, 4 }, /* rfc5758 */
315    _oidMd2[]                       = { OID_RSA_HASH, 2 },
316    _oidMd4[]                       = { OID_RSA_HASH, 4 },
317    _oidMd5[]                       = { OID_RSA_HASH, 5 },
318    _oidSha1[]                      = { OID_OIW_ALGORITHM, 26 },
319    _oidSha256[]                    = { OID_NIST_HASHALG, 1 },
320    _oidSha384[]                    = { OID_NIST_HASHALG, 2 },
321    _oidSha512[]                    = { OID_NIST_HASHALG, 3 },
322    _oidSha224[]                    = { OID_NIST_HASHALG, 4 };
323
324const DERItem
325    oidRsa                          = { (DERByte *)_oidRsa,
326                                        sizeof(_oidRsa) },
327    oidMd2Rsa                       = { (DERByte *)_oidMd2Rsa,
328                                        sizeof(_oidMd2Rsa) },
329    oidMd5Rsa                       = { (DERByte *)_oidMd5Rsa,
330                                        sizeof(_oidMd5Rsa) },
331    oidSha1Rsa                      = { (DERByte *)_oidSha1Rsa,
332                                        sizeof(_oidSha1Rsa) },
333    oidSha256Rsa                    = { (DERByte *)_oidSha256Rsa,
334                                        sizeof(_oidSha256Rsa) },
335    oidEcPubKey                     = { (DERByte *)_oidEcPubKey,
336                                        sizeof(_oidEcPubKey) },
337    oidSha1Ecdsa                    = { (DERByte *)_oidSha1Ecdsa,
338                                        sizeof(_oidSha1Ecdsa) },
339    oidSha224Ecdsa                    = { (DERByte *)_oidSha224Ecdsa,
340                                        sizeof(_oidSha224Ecdsa) },
341    oidSha256Ecdsa                    = { (DERByte *)_oidSha256Ecdsa,
342                                        sizeof(_oidSha256Ecdsa) },
343    oidSha384Ecdsa                    = { (DERByte *)_oidSha384Ecdsa,
344                                        sizeof(_oidSha384Ecdsa) },
345    oidSha512Ecdsa                    = { (DERByte *)_oidSha512Ecdsa,
346                                        sizeof(_oidSha512Ecdsa) },
347    oidMd2                          = { (DERByte *)_oidMd2,
348                                        sizeof(_oidMd2) },
349    oidMd4                          = { (DERByte *)_oidMd4,
350                                        sizeof(_oidMd4) },
351    oidMd5                          = { (DERByte *)_oidMd5,
352                                        sizeof(_oidMd5) },
353    oidSha1                         = { (DERByte *)_oidSha1,
354                                        sizeof(_oidSha1) },
355    oidSha256                       = { (DERByte *)_oidSha256,
356                                        sizeof(_oidSha256) },
357    oidSha384                       = { (DERByte *)_oidSha384,
358                                        sizeof(_oidSha384) },
359    oidSha512                       = { (DERByte *)_oidSha512,
360                                        sizeof(_oidSha512) },
361    oidSha224                       = { (DERByte *)_oidSha224,
362                                        sizeof(_oidSha224) };
363
364/* Extension OIDs. */
365__unused static const DERByte
366    _oidSubjectKeyIdentifier[]      = { OID_EXTENSION, 14 },
367    _oidKeyUsage[]                  = { OID_EXTENSION, 15 },
368    _oidPrivateKeyUsagePeriod[]     = { OID_EXTENSION, 16 },
369    _oidSubjectAltName[]            = { OID_EXTENSION, 17 },
370    _oidIssuerAltName[]             = { OID_EXTENSION, 18 },
371    _oidBasicConstraints[]          = { OID_EXTENSION, 19 },
372    _oidCrlDistributionPoints[]     = { OID_EXTENSION, 31 },
373    _oidCertificatePolicies[]       = { OID_EXTENSION, 32 },
374    _oidAnyPolicy[]                 = { OID_EXTENSION, 32, 0 },
375    _oidPolicyMappings[]            = { OID_EXTENSION, 33 },
376    _oidAuthorityKeyIdentifier[]    = { OID_EXTENSION, 35 },
377    _oidPolicyConstraints[]         = { OID_EXTENSION, 36 },
378    _oidExtendedKeyUsage[]          = { OID_EXTENSION, 37 },
379    _oidAnyExtendedKeyUsage[]          = { OID_EXTENSION, 37, 0 },
380    _oidInhibitAnyPolicy[]          = { OID_EXTENSION, 54 },
381    _oidAuthorityInfoAccess[]       = { OID_PE, 1 },
382    _oidSubjectInfoAccess[]         = { OID_PE, 11 },
383    _oidAdOCSP[]                    = { OID_AD_OCSP },
384    _oidAdCAIssuer[]                = { OID_AD_CAISSUERS },
385    _oidNetscapeCertType[]          = { NETSCAPE_CERT_EXTEN, 1 },
386    _oidEntrustVersInfo[]           = { ENTRUST_CERT_EXTEN, 0 },
387    _oidMSNTPrincipalName[]         = { MICROSOFT_ENROLLMENT_OID, 2, 3 },
388    /* Policy Qualifier IDs for Internet policy qualifiers. */
389    _oidQtCps[]                     = { OID_QT, 1 },
390    _oidQtUNotice[]                 = { OID_QT, 2 },
391    /* X.501 Name IDs. */
392    _oidCommonName[]                = { OID_ATTR_TYPE, 3 },
393    _oidCountryName[]               = { OID_ATTR_TYPE, 6 },
394    _oidLocalityName[]              = { OID_ATTR_TYPE, 7 },
395    _oidStateOrProvinceName[]       = { OID_ATTR_TYPE, 8 },
396    _oidOrganizationName[]          = { OID_ATTR_TYPE, 10 },
397    _oidOrganizationalUnitName[]    = { OID_ATTR_TYPE, 11 },
398    _oidDescription[]               = { OID_ATTR_TYPE, 13 },
399    _oidEmailAddress[]              = { OID_PKCS_9, 1 },
400    _oidFriendlyName[]              = { OID_PKCS_9, 20 },
401    _oidLocalKeyId[]                = { OID_PKCS_9, 21 },
402    _oidExtendedKeyUsageServerAuth[] = { OID_KP, 1 },
403    _oidExtendedKeyUsageClientAuth[] = { OID_KP, 2 },
404    _oidExtendedKeyUsageCodeSigning[] = { OID_KP, 3 },
405    _oidExtendedKeyUsageEmailProtection[] = { OID_KP, 4 },
406    _oidExtendedKeyUsageOCSPSigning[] = { OID_KP, 9 },
407    _oidExtendedKeyUsageIPSec[]     = { OID_ISAKMP, 2, 2 },
408    _oidExtendedKeyUsageMicrosoftSGC[] = { MICROSOFT_BASE_OID, 10, 3, 3 },
409    _oidExtendedKeyUsageNetscapeSGC[] = { NETSCAPE_CERT_POLICY, 1 },
410    _oidAppleSecureBootCertSpec[]   = { APPLE_SBOOT_CERT_EXTEN_SBOOT_SPEC_OID },
411    _oidAppleProvisioningProfile[]  = {APPLE_PROVISIONING_PROFILE_OID },
412    _oidAppleApplicationSigning[]   = { APPLE_APP_SIGNING_OID },
413    _oidAppleInstallerPackagingSigningExternal[]       = { APPLE_INSTALLER_PACKAGE_SIGNING_EXTERNAL_OID },
414    _oidAppleExtendedKeyUsageAppleID[] = { APPLE_EKU_APPLE_ID },
415    _oidAppleExtendedKeyUsageShoebox[] = { APPLE_EKU_SHOEBOX },
416    _oidAppleExtendedKeyUsageProfileSigning[] = { APPLE_EKU_PROFILE_SIGNING },
417    _oidAppleExtendedKeyUsageQAProfileSigning[] = { APPLE_EKU_QA_PROFILE_SIGNING },
418    _oidAppleIntmMarkerAppleID[] = { APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID },
419    _oidAppleIntmMarkerAppleID2[] = {APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_2 },
420    _oidApplePushServiceClient[]   =   { APPLE_CERT_EXT_APPLE_PUSH_MARKER, 2 },
421    _oidApplePolicyMobileStore[]  = { APPLE_CERT_POLICY_MOBILE_STORE },
422    _oidApplePolicyTestMobileStore[] = { APPLE_CERT_POLICY_TEST_MOBILE_STORE },
423    _oidApplePolicyEscrowService[] = { APPLE_ESCROW_POLICY_OID },
424    _oidAppleCertExtensionAppleIDRecordValidationSigning[] = { APPLE_CERT_EXT_APPLE_ID_VALIDATION_RECORD_SIGNING },
425    _oidAppleIntmMarkerAppleSystemIntg2[] =  {APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_SYSTEM_INTEGRATION_2},
426    _oidAppleIntmMarkerAppleSystemIntgG3[] =  {APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLEID_SYSTEM_INTEGRATION_G3},
427    _oidAppleCertExtAppleSMPEncryption[] = {APPLE_CERT_EXT_APPLE_SMP_ENCRYPTION},
428    _oidAppleCertExtAppleServerAuthentication[] = {APPLE_CERT_EXT_APPLE_SERVER_AUTHENTICATION},
429    _oidAppleIntmMarkerAppleServerAuthentication[] = {APPLE_CERT_EXT_INTERMEDIATE_MARKER_APPLE_SERVER_AUTHENTICATION};
430
431__unused const DERItem
432    oidSubjectKeyIdentifier         = { (DERByte *)_oidSubjectKeyIdentifier,
433                                        sizeof(_oidSubjectKeyIdentifier) },
434    oidKeyUsage                     = { (DERByte *)_oidKeyUsage,
435                                        sizeof(_oidKeyUsage) },
436    oidPrivateKeyUsagePeriod        = { (DERByte *)_oidPrivateKeyUsagePeriod,
437                                        sizeof(_oidPrivateKeyUsagePeriod) },
438    oidSubjectAltName               = { (DERByte *)_oidSubjectAltName,
439                                        sizeof(_oidSubjectAltName) },
440    oidIssuerAltName                = { (DERByte *)_oidIssuerAltName,
441                                        sizeof(_oidIssuerAltName) },
442    oidBasicConstraints             = { (DERByte *)_oidBasicConstraints,
443                                        sizeof(_oidBasicConstraints) },
444    oidCrlDistributionPoints        = { (DERByte *)_oidCrlDistributionPoints,
445                                        sizeof(_oidCrlDistributionPoints) },
446    oidCertificatePolicies          = { (DERByte *)_oidCertificatePolicies,
447                                        sizeof(_oidCertificatePolicies) },
448    oidAnyPolicy                    = { (DERByte *)_oidAnyPolicy,
449                                        sizeof(_oidAnyPolicy) },
450    oidPolicyMappings               = { (DERByte *)_oidPolicyMappings,
451                                        sizeof(_oidPolicyMappings) },
452    oidAuthorityKeyIdentifier       = { (DERByte *)_oidAuthorityKeyIdentifier,
453                                        sizeof(_oidAuthorityKeyIdentifier) },
454    oidPolicyConstraints            = { (DERByte *)_oidPolicyConstraints,
455                                        sizeof(_oidPolicyConstraints) },
456    oidExtendedKeyUsage             = { (DERByte *)_oidExtendedKeyUsage,
457                                        sizeof(_oidExtendedKeyUsage) },
458    oidAnyExtendedKeyUsage          = { (DERByte *)_oidAnyExtendedKeyUsage,
459                                        sizeof(_oidAnyExtendedKeyUsage) },
460    oidInhibitAnyPolicy             = { (DERByte *)_oidInhibitAnyPolicy,
461                                        sizeof(_oidInhibitAnyPolicy) },
462    oidAuthorityInfoAccess          = { (DERByte *)_oidAuthorityInfoAccess,
463                                        sizeof(_oidAuthorityInfoAccess) },
464    oidSubjectInfoAccess            = { (DERByte *)_oidSubjectInfoAccess,
465                                        sizeof(_oidSubjectInfoAccess) },
466    oidAdOCSP                       = { (DERByte *)_oidAdOCSP,
467                                        sizeof(_oidAdOCSP) },
468    oidAdCAIssuer                   = { (DERByte *)_oidAdCAIssuer,
469                                        sizeof(_oidAdCAIssuer) },
470    oidNetscapeCertType             = { (DERByte *)_oidNetscapeCertType,
471                                        sizeof(_oidNetscapeCertType) },
472    oidEntrustVersInfo              = { (DERByte *)_oidEntrustVersInfo,
473                                        sizeof(_oidEntrustVersInfo) },
474    oidMSNTPrincipalName              = { (DERByte *)_oidMSNTPrincipalName,
475                                        sizeof(_oidMSNTPrincipalName) },
476    /* Policy Qualifier IDs for Internet policy qualifiers. */
477    oidQtCps                        = { (DERByte *)_oidQtCps,
478                                        sizeof(_oidQtCps) },
479    oidQtUNotice                    = { (DERByte *)_oidQtUNotice,
480                                        sizeof(_oidQtUNotice) },
481    /* X.501 Name IDs. */
482    oidCommonName                   = { (DERByte *)_oidCommonName,
483                                        sizeof(_oidCommonName) },
484    oidCountryName                  = { (DERByte *)_oidCountryName,
485                                        sizeof(_oidCountryName) },
486    oidLocalityName                 = { (DERByte *)_oidLocalityName,
487                                        sizeof(_oidLocalityName) },
488    oidStateOrProvinceName          = { (DERByte *)_oidStateOrProvinceName,
489                                        sizeof(_oidStateOrProvinceName) },
490    oidOrganizationName             = { (DERByte *)_oidOrganizationName,
491                                        sizeof(_oidOrganizationName) },
492    oidOrganizationalUnitName       = { (DERByte *)_oidOrganizationalUnitName,
493                                        sizeof(_oidOrganizationalUnitName) },
494    oidDescription                  = { (DERByte *)_oidDescription,
495                                        sizeof(_oidDescription) },
496    oidEmailAddress                 = { (DERByte *)_oidEmailAddress,
497                                        sizeof(_oidEmailAddress) },
498    oidFriendlyName                 = { (DERByte *)_oidFriendlyName,
499                                        sizeof(_oidFriendlyName) },
500    oidLocalKeyId                   = { (DERByte *)_oidLocalKeyId,
501                                        sizeof(_oidLocalKeyId) },
502    oidExtendedKeyUsageServerAuth   = { (DERByte *)_oidExtendedKeyUsageServerAuth,
503                                        sizeof(_oidExtendedKeyUsageServerAuth) },
504    oidExtendedKeyUsageClientAuth   = { (DERByte *)_oidExtendedKeyUsageClientAuth,
505                                        sizeof(_oidExtendedKeyUsageClientAuth) },
506    oidExtendedKeyUsageCodeSigning  = { (DERByte *)_oidExtendedKeyUsageCodeSigning,
507                                        sizeof(_oidExtendedKeyUsageCodeSigning) },
508    oidExtendedKeyUsageEmailProtection  = { (DERByte *)_oidExtendedKeyUsageEmailProtection,
509                                        sizeof(_oidExtendedKeyUsageEmailProtection) },
510    oidExtendedKeyUsageOCSPSigning  = { (DERByte *)_oidExtendedKeyUsageOCSPSigning,
511                                        sizeof(_oidExtendedKeyUsageOCSPSigning) },
512    oidExtendedKeyUsageIPSec        = { (DERByte *)_oidExtendedKeyUsageIPSec,
513                                        sizeof(_oidExtendedKeyUsageIPSec) },
514    oidExtendedKeyUsageMicrosoftSGC = { (DERByte *)_oidExtendedKeyUsageMicrosoftSGC,
515                                        sizeof(_oidExtendedKeyUsageMicrosoftSGC) },
516    oidExtendedKeyUsageNetscapeSGC  = { (DERByte *)_oidExtendedKeyUsageNetscapeSGC,
517                                        sizeof(_oidExtendedKeyUsageNetscapeSGC) },
518    oidAppleSecureBootCertSpec      = { (DERByte *)_oidAppleSecureBootCertSpec,
519                                        sizeof(_oidAppleSecureBootCertSpec) },
520    oidAppleProvisioningProfile     = { (DERByte *)_oidAppleProvisioningProfile,
521                                        sizeof(_oidAppleProvisioningProfile) },
522    oidAppleApplicationSigning      = { (DERByte *)_oidAppleApplicationSigning,
523                                         sizeof(_oidAppleApplicationSigning) },
524    oidAppleInstallerPackagingSigningExternal          = { (DERByte *)_oidAppleInstallerPackagingSigningExternal,
525                                                            sizeof(_oidAppleInstallerPackagingSigningExternal) },
526    oidAppleExtendedKeyUsageAppleID = { (DERByte *)_oidAppleExtendedKeyUsageAppleID,
527                                        sizeof(_oidAppleExtendedKeyUsageAppleID) },
528    oidAppleExtendedKeyUsageShoebox = { (DERByte *)_oidAppleExtendedKeyUsageShoebox,
529                                        sizeof(_oidAppleExtendedKeyUsageShoebox) },
530    oidAppleExtendedKeyUsageProfileSigning
531                                     = { (DERByte *)_oidAppleExtendedKeyUsageProfileSigning,
532                                        sizeof(_oidAppleExtendedKeyUsageProfileSigning) },
533    oidAppleExtendedKeyUsageQAProfileSigning
534                                    = { (DERByte *)_oidAppleExtendedKeyUsageQAProfileSigning,
535                                        sizeof(_oidAppleExtendedKeyUsageQAProfileSigning) },
536    oidAppleIntmMarkerAppleID       = { (DERByte *)_oidAppleIntmMarkerAppleID,
537                                        sizeof(_oidAppleIntmMarkerAppleID) },
538    oidAppleIntmMarkerAppleID2      = { (DERByte *)_oidAppleIntmMarkerAppleID2,
539                                        sizeof(_oidAppleIntmMarkerAppleID2) },
540    oidApplePushServiceClient       = { (DERByte *)_oidAppleIntmMarkerAppleID2,
541                                        sizeof(_oidAppleIntmMarkerAppleID2) },
542    oidApplePolicyMobileStore       = { (DERByte *)_oidApplePolicyMobileStore,
543                                        sizeof(_oidApplePolicyMobileStore)},
544    oidApplePolicyTestMobileStore   = { (DERByte *)_oidApplePolicyTestMobileStore,
545                                        sizeof(_oidApplePolicyTestMobileStore)},
546    oidApplePolicyEscrowService     = { (DERByte *)_oidApplePolicyEscrowService,
547                                        sizeof(_oidApplePolicyEscrowService)},
548    oidAppleCertExtensionAppleIDRecordValidationSigning = { (DERByte *)_oidAppleCertExtensionAppleIDRecordValidationSigning,
549                                        sizeof(_oidAppleCertExtensionAppleIDRecordValidationSigning)},
550    oidAppleIntmMarkerAppleSystemIntg2 = { (DERByte *) _oidAppleIntmMarkerAppleSystemIntg2,
551                                        sizeof(_oidAppleIntmMarkerAppleSystemIntg2)},
552    oidAppleIntmMarkerAppleSystemIntgG3 = { (DERByte *) _oidAppleIntmMarkerAppleSystemIntgG3,
553                                        sizeof(_oidAppleIntmMarkerAppleSystemIntgG3)},
554    oidAppleCertExtAppleSMPEncryption = { (DERByte *)_oidAppleCertExtAppleSMPEncryption,
555                                        sizeof(_oidAppleCertExtAppleSMPEncryption)},
556    oidAppleCertExtAppleServerAuthentication
557                                      = { (DERByte *)_oidAppleCertExtAppleServerAuthentication,
558                                        sizeof(_oidAppleCertExtAppleServerAuthentication) },
559    oidAppleIntmMarkerAppleServerAuthentication
560                                      = { (DERByte *)_oidAppleIntmMarkerAppleServerAuthentication,
561                                        sizeof(_oidAppleIntmMarkerAppleServerAuthentication) };
562
563
564bool DEROidCompare(const DERItem *oid1, const DERItem *oid2) {
565	if ((oid1 == NULL) || (oid2 == NULL)) {
566		return false;
567	}
568	if (oid1->length != oid2->length) {
569		return false;
570	}
571	if (!DERMemcmp(oid1->data, oid2->data, oid1->length)) {
572		return true;
573	} else {
574		return false;
575	}
576}
577