]> git.saurik.com Git - apple/security.git/blob - cdsa/cssm/oidscert.cpp
Security-54.1.tar.gz
[apple/security.git] / cdsa / cssm / oidscert.cpp
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 /*
20
21 File: oidscert.cpp
22
23 Contains: Object Identifiers for X509 Certificate Library
24
25 Copyright: (c) 1999 Apple Computer, Inc., all rights reserved.
26
27 */
28
29 #include <Security/oidscert.h>
30
31 static const uint8
32
33 /* Certificate OID Fields */
34 X509V3SignedCertificate[] = {INTEL_X509V3_CERT_R08, 0},
35 X509V3SignedCertificateCStruct[] = {INTEL_X509V3_CERT_R08, 0, INTEL_X509_C_DATATYPE},
36 X509V3Certificate[] = {INTEL_X509V3_CERT_R08, 1},
37 X509V3CertificateCStruct[] = {INTEL_X509V3_CERT_R08, 1, INTEL_X509_C_DATATYPE},
38 X509V1Version[] = {INTEL_X509V3_CERT_R08, 2},
39 X509V1SerialNumber[] = {INTEL_X509V3_CERT_R08, 3},
40 X509V1IssuerName[] = {INTEL_X509V3_CERT_R08, 5},
41 X509V1IssuerNameCStruct[] = {INTEL_X509V3_CERT_R08, 5, INTEL_X509_C_DATATYPE},
42 X509V1IssuerNameLDAP[] = {INTEL_X509V3_CERT_R08, 5, INTEL_X509_LDAPSTRING_DATATYPE},
43 X509V1ValidityNotBefore[] = {INTEL_X509V3_CERT_R08, 6},
44 X509V1ValidityNotAfter[] = {INTEL_X509V3_CERT_R08, 7},
45 X509V1SubjectName[] = {INTEL_X509V3_CERT_R08, 8},
46 X509V1SubjectNameCStruct[] = {INTEL_X509V3_CERT_R08, 8, INTEL_X509_C_DATATYPE},
47 X509V1SubjectNameLDAP[] = {INTEL_X509V3_CERT_R08, 8, INTEL_X509_LDAPSTRING_DATATYPE},
48 X509V1SubjectPublicKeyAlgorithm[] = {INTEL_X509V3_CERT_R08, 9},
49 X509V1SubjectPublicKey[] = {INTEL_X509V3_CERT_R08, 10},
50 X509V1CertificateIssuerUniqueId[] = {INTEL_X509V3_CERT_R08, 11},
51 X509V1CertificateSubjectUniqueId[] = {INTEL_X509V3_CERT_R08, 12},
52 X509V3CertificateExtensionStruct[] = {INTEL_X509V3_CERT_R08, 13},
53 X509V3CertificateExtensionCStruct[] = {INTEL_X509V3_CERT_R08, 13, INTEL_X509_C_DATATYPE},
54 X509V3CertificateNumberOfExtensions[] = {INTEL_X509V3_CERT_R08, 14},
55 X509V3CertificateExtensionId[] = {INTEL_X509V3_CERT_R08, 15},
56 X509V3CertificateExtensionCritical[] = {INTEL_X509V3_CERT_R08, 16},
57 X509V3CertificateExtensionValue[] = {INTEL_X509V3_CERT_R08, 17},
58 X509V1SubjectPublicKeyAlgorithmParameters[] = {INTEL_X509V3_CERT_R08, 18},
59 X509V3CertificateExtensionType[] = {INTEL_X509V3_CERT_R08, 19},
60 CSSMKeyStruct[] = {INTEL_X509V3_CERT_R08, 20},
61 X509V1SubjectPublicKeyCStruct[] = {INTEL_X509V3_CERT_R08, 20, INTEL_X509_C_DATATYPE},
62 X509V3CertificateExtensionsStruct[] = {INTEL_X509V3_CERT_R08, 21},
63 X509V3CertificateExtensionsCStruct[] = {INTEL_X509V3_CERT_R08, 21, INTEL_X509_C_DATATYPE},
64
65 /* Signature OID Fields */
66 X509V1SignatureStruct[] = {INTEL_X509V3_SIGN_R08, 0},
67 X509V1SignatureCStruct[] = {INTEL_X509V3_SIGN_R08, 0, INTEL_X509_C_DATATYPE},
68 /* for the algorithm ID in the cert proper */
69 X509V1SignatureAlgorithm[] = {INTEL_X509V3_SIGN_R08, 1},
70 /* for the one in TBSCert */
71 X509V1SignatureAlgorithmTBS[] = {INTEL_X509V3_SIGN_R08, 10},
72 X509V1SignatureAlgorithmParameters[] = {INTEL_X509V3_SIGN_R08, 3},
73 X509V1Signature[] = {INTEL_X509V3_SIGN_R08, 2},
74
75 /* Extension OID Fields */
76 SubjectSignatureBitmap[] = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS, 1},
77 SubjectPicture[] = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS, 2},
78 SubjectEmailAddress[] = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS, 3},
79 UseExemptions[] = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS, 4};
80
81
82 const CSSM_OID
83
84 /* Certificate OIDS */
85 CSSMOID_X509V3SignedCertificate = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3SignedCertificate},
86 CSSMOID_X509V3SignedCertificateCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V3SignedCertificateCStruct},
87 CSSMOID_X509V3Certificate = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3Certificate},
88 CSSMOID_X509V3CertificateCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V3CertificateCStruct},
89 CSSMOID_X509V1Version = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1Version},
90 CSSMOID_X509V1SerialNumber = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1SerialNumber},
91 CSSMOID_X509V1IssuerName = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1IssuerName},
92 CSSMOID_X509V1IssuerNameCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V1IssuerNameCStruct},
93 CSSMOID_X509V1IssuerNameLDAP = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V1IssuerNameLDAP},
94 CSSMOID_X509V1ValidityNotBefore = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1ValidityNotBefore},
95 CSSMOID_X509V1ValidityNotAfter = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1ValidityNotAfter},
96 CSSMOID_X509V1SubjectName = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1SubjectName},
97 CSSMOID_X509V1SubjectNameCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V1SubjectNameCStruct},
98 CSSMOID_X509V1SubjectNameLDAP = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V1SubjectNameLDAP},
99 CSSMOID_CSSMKeyStruct = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)CSSMKeyStruct},
100 CSSMOID_X509V1SubjectPublicKeyCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V1SubjectPublicKeyCStruct},
101 CSSMOID_X509V1SubjectPublicKeyAlgorithm = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1SubjectPublicKeyAlgorithm},
102 CSSMOID_X509V1SubjectPublicKeyAlgorithmParameters = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1SubjectPublicKeyAlgorithmParameters},
103 CSSMOID_X509V1SubjectPublicKey = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1SubjectPublicKey},
104 CSSMOID_X509V1CertificateIssuerUniqueId = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1CertificateIssuerUniqueId},
105 CSSMOID_X509V1CertificateSubjectUniqueId = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V1CertificateSubjectUniqueId},
106 CSSMOID_X509V3CertificateExtensionsStruct = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionsStruct},
107 CSSMOID_X509V3CertificateExtensionsCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V3CertificateExtensionsCStruct},
108 CSSMOID_X509V3CertificateNumberOfExtensions = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateNumberOfExtensions},
109 CSSMOID_X509V3CertificateExtensionStruct = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionStruct},
110 CSSMOID_X509V3CertificateExtensionCStruct = {INTEL_X509V3_CERT_R08_LENGTH+2, (uint8 *)X509V3CertificateExtensionCStruct},
111 CSSMOID_X509V3CertificateExtensionId = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionId},
112 CSSMOID_X509V3CertificateExtensionCritical = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionCritical},
113 CSSMOID_X509V3CertificateExtensionType = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionType},
114 CSSMOID_X509V3CertificateExtensionValue = {INTEL_X509V3_CERT_R08_LENGTH+1, (uint8 *)X509V3CertificateExtensionValue},
115
116 /* Signature OID Fields */
117 CSSMOID_X509V1SignatureStruct = {INTEL_X509V3_SIGN_R08_LENGTH+1, (uint8 *)X509V1SignatureStruct},
118 CSSMOID_X509V1SignatureCStruct = {INTEL_X509V3_SIGN_R08_LENGTH+2, (uint8 *)X509V1SignatureCStruct},
119 CSSMOID_X509V1SignatureAlgorithm = {INTEL_X509V3_SIGN_R08_LENGTH+1, (uint8 *)X509V1SignatureAlgorithm},
120 CSSMOID_X509V1SignatureAlgorithmTBS = {INTEL_X509V3_SIGN_R08_LENGTH+1, (uint8 *)X509V1SignatureAlgorithmTBS},
121 CSSMOID_X509V1SignatureAlgorithmParameters = {INTEL_X509V3_SIGN_R08_LENGTH+1, (uint8 *)X509V1SignatureAlgorithmParameters},
122 CSSMOID_X509V1Signature = {INTEL_X509V3_SIGN_R08_LENGTH+1, (uint8 *)X509V1Signature},
123
124 /* Extension OID Fields */
125 CSSMOID_SubjectSignatureBitmap = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS_LENGTH+1, (uint8 *)SubjectSignatureBitmap},
126 CSSMOID_SubjectPicture = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS_LENGTH+1, (uint8 *)SubjectPicture},
127 CSSMOID_SubjectEmailAddress = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS_LENGTH+1, (uint8 *)SubjectEmailAddress},
128 CSSMOID_UseExemptions = {INTEL_X509V3_CERT_PRIVATE_EXTENSIONS_LENGTH+1, (uint8 *)UseExemptions};
129
130 /***
131 *** Apple addenda.
132 ***/
133
134 /*
135 * Standard Cert extensions.
136 */
137 static const uint8
138 OID_SubjectDirectoryAttributes[] = { OID_EXTENSION, 9 },
139 OID_SubjectKeyIdentifier[] = { OID_EXTENSION, 14 },
140 OID_KeyUsage[] = { OID_EXTENSION, 15 },
141 OID_PrivateKeyUsagePeriod[] = { OID_EXTENSION, 16 },
142 OID_SubjectAltName[] = { OID_EXTENSION, 17 },
143 OID_IssuerAltName[] = { OID_EXTENSION, 18 },
144 OID_BasicConstraints[] = { OID_EXTENSION, 19 },
145 OID_CrlNumber[] = { OID_EXTENSION, 20 },
146 OID_CrlReason[] = { OID_EXTENSION, 21 },
147 OID_HoldInstructionCode[] = { OID_EXTENSION, 23 },
148 OID_InvalidityDate[] = { OID_EXTENSION, 24 },
149 OID_DeltaCrlIndicator[] = { OID_EXTENSION, 27 },
150 OID_IssuingDistributionPoints[] = { OID_EXTENSION, 28 },
151 OID_NameConstraints[] = { OID_EXTENSION, 30 },
152 OID_CrlDistributionPoints[] = { OID_EXTENSION, 31 },
153 OID_CertificatePolicies[] = { OID_EXTENSION, 32 },
154 OID_PolicyMappings[] = { OID_EXTENSION, 33 },
155 OID_AuthorityKeyIdentifier[] = { OID_EXTENSION, 35 },
156 OID_PolicyConstraints[] = { OID_EXTENSION, 36 },
157 OID_ExtendedKeyUsage[] = { OID_EXTENSION, 37 },
158 OID_ExtendedUseCodeSigning[] = { OID_EXTENSION, 37, 3 }
159 ;
160
161 #define OID_PKCS_CE_LENGTH OID_EXTENSION_LENGTH + 1
162
163 const CSSM_OID
164 CSSMOID_SubjectDirectoryAttributes = { OID_PKCS_CE_LENGTH, (uint8 *)OID_SubjectDirectoryAttributes},
165 CSSMOID_SubjectKeyIdentifier = { OID_PKCS_CE_LENGTH, (uint8 *)OID_SubjectKeyIdentifier},
166 CSSMOID_KeyUsage = { OID_PKCS_CE_LENGTH, (uint8 *)OID_KeyUsage},
167 CSSMOID_PrivateKeyUsagePeriod = { OID_PKCS_CE_LENGTH, (uint8 *)OID_PrivateKeyUsagePeriod},
168 CSSMOID_SubjectAltName = { OID_PKCS_CE_LENGTH, (uint8 *)OID_SubjectAltName},
169 CSSMOID_IssuerAltName = { OID_PKCS_CE_LENGTH, (uint8 *)OID_IssuerAltName},
170 CSSMOID_BasicConstraints = { OID_PKCS_CE_LENGTH, (uint8 *)OID_BasicConstraints},
171 CSSMOID_CrlNumber = { OID_PKCS_CE_LENGTH, (uint8 *)OID_CrlNumber},
172 CSSMOID_CrlReason = { OID_PKCS_CE_LENGTH, (uint8 *)OID_CrlReason},
173 CSSMOID_HoldInstructionCode = { OID_PKCS_CE_LENGTH, (uint8 *)OID_HoldInstructionCode},
174 CSSMOID_InvalidityDate = { OID_PKCS_CE_LENGTH, (uint8 *)OID_InvalidityDate},
175 CSSMOID_DeltaCrlIndicator = { OID_PKCS_CE_LENGTH, (uint8 *)OID_DeltaCrlIndicator},
176 CSSMOID_IssuingDistributionPoints = { OID_PKCS_CE_LENGTH, (uint8 *)OID_IssuingDistributionPoints},
177 CSSMOID_NameConstraints = { OID_PKCS_CE_LENGTH, (uint8 *)OID_NameConstraints},
178 CSSMOID_CrlDistributionPoints = { OID_PKCS_CE_LENGTH, (uint8 *)OID_CrlDistributionPoints},
179 CSSMOID_CertificatePolicies = { OID_PKCS_CE_LENGTH, (uint8 *)OID_CertificatePolicies},
180 CSSMOID_PolicyMappings = { OID_PKCS_CE_LENGTH, (uint8 *)OID_PolicyMappings},
181 CSSMOID_PolicyConstraints = { OID_PKCS_CE_LENGTH, (uint8 *)OID_PolicyConstraints},
182 CSSMOID_AuthorityKeyIdentifier = { OID_PKCS_CE_LENGTH, (uint8 *)OID_AuthorityKeyIdentifier},
183 CSSMOID_ExtendedKeyUsage = { OID_PKCS_CE_LENGTH, (uint8 *)OID_ExtendedKeyUsage},
184 CSSMOID_ExtendedUseCodeSigning = { OID_PKCS_CE_LENGTH+1, (uint8 *)OID_ExtendedUseCodeSigning};
185
186
187 /*
188 * Netscape extensions.
189 *
190 * netscape-cert-type OBJECT IDENTIFIER ::=
191 * { 2 16 840 1 113730 1 1 }
192 *
193 * BER = 06 08 60 86 48 01 86 F8 42 01 01
194 */
195 static const uint8 OID_NetscapeCertType[] = {NETSCAPE_CERT_EXTEN, 1};
196 const CSSM_OID CSSMOID_NetscapeCertType =
197 {NETSCAPE_CERT_EXTEN_LENGTH + 1, (uint8 *)OID_NetscapeCertType};
198