]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_asn1/security_asn1/oidsattr.c
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / libsecurity_asn1 / security_asn1 / oidsattr.c
1 /*
2 * Copyright (c) 2000-2001,2003-2004,2008,2010,2012,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 * oidsattr.c - Cert/CRL related OIDs.
27 */
28
29 #include <Security/oidsbase.h>
30 #include <Security/oidsattr.h>
31
32
33 /*
34 * Directory name component identifiers.
35 */
36 static const uint8_t
37 OID_ObjectClass[] = { OID_ATTR_TYPE, 0 },
38 OID_AliasedEntryName[] = { OID_ATTR_TYPE, 1 },
39 OID_KnowledgeInformation[] = { OID_ATTR_TYPE, 2 },
40 OID_CommonName[] = { OID_ATTR_TYPE, 3 },
41 OID_Surname[] = { OID_ATTR_TYPE, 4 },
42 OID_SerialNumber[] = { OID_ATTR_TYPE, 5 },
43 OID_CountryName[] = { OID_ATTR_TYPE, 6 },
44 OID_LocalityName[] = { OID_ATTR_TYPE, 7 },
45 OID_StateProvinceName[] = { OID_ATTR_TYPE, 8 },
46 OID_CollectiveStateProvinceName[] = { OID_ATTR_TYPE, 8, 1 },
47 OID_StreetAddress[] = { OID_ATTR_TYPE, 9 },
48 OID_CollectiveStreetAddress[] = { OID_ATTR_TYPE, 9, 1 },
49 OID_OrganizationName[] = { OID_ATTR_TYPE, 10 },
50 OID_CollectiveOrganizationName[] = { OID_ATTR_TYPE, 10, 1 },
51 OID_OrganizationalUnitName[] = { OID_ATTR_TYPE, 11 },
52 OID_CollectiveOrganizationalUnitName[]
53 = { OID_ATTR_TYPE, 11, 1 },
54 OID_Title[] = { OID_ATTR_TYPE, 12 },
55 OID_Description[] = { OID_ATTR_TYPE, 13 },
56 OID_SearchGuide[] = { OID_ATTR_TYPE, 14 },
57 OID_BusinessCategory[] = { OID_ATTR_TYPE, 15 },
58 OID_PostalAddress[] = { OID_ATTR_TYPE, 16 },
59 OID_CollectivePostalAddress[] = { OID_ATTR_TYPE, 16, 1 },
60 OID_PostalCode[] = { OID_ATTR_TYPE, 17 },
61 OID_CollectivePostalCode[] = { OID_ATTR_TYPE, 17, 1 },
62 OID_PostOfficeBox[] = { OID_ATTR_TYPE, 18 },
63 OID_CollectivePostOfficeBox[] = { OID_ATTR_TYPE, 18, 1 },
64 OID_PhysicalDeliveryOfficeName[] = { OID_ATTR_TYPE, 19 },
65 OID_CollectivePhysicalDeliveryOfficeName[]
66 = { OID_ATTR_TYPE, 19, 1 },
67 OID_TelephoneNumber[] = { OID_ATTR_TYPE, 20 },
68 OID_CollectiveTelephoneNumber[] = { OID_ATTR_TYPE, 20, 1 },
69 OID_TelexNumber[] = { OID_ATTR_TYPE, 21 },
70 OID_CollectiveTelexNumber[] = { OID_ATTR_TYPE, 21, 1 },
71 OID_TelexTerminalIdentifier[] = { OID_ATTR_TYPE, 22 },
72 OID_CollectiveTelexTerminalIdentifier[]
73 = { OID_ATTR_TYPE, 22, 1 },
74 OID_FacsimileTelephoneNumber[] = { OID_ATTR_TYPE, 23 },
75 OID_CollectiveFacsimileTelephoneNumber[]
76 = { OID_ATTR_TYPE, 23, 1 },
77 OID_X_121Address[] = { OID_ATTR_TYPE, 24 },
78 OID_InternationalISDNNumber[] = { OID_ATTR_TYPE, 25 },
79 OID_CollectiveInternationalISDNNumber[]
80 = { OID_ATTR_TYPE, 25, 1 },
81 OID_RegisteredAddress[] = { OID_ATTR_TYPE, 26 },
82 OID_DestinationIndicator[] = { OID_ATTR_TYPE, 27 },
83 OID_PreferredDeliveryMethod[] = { OID_ATTR_TYPE, 28 },
84 OID_PresentationAddress[] = { OID_ATTR_TYPE, 29 },
85 OID_SupportedApplicationContext[] = { OID_ATTR_TYPE, 30 },
86 OID_Member[] = { OID_ATTR_TYPE, 31 },
87 OID_Owner[] = { OID_ATTR_TYPE, 32 },
88 OID_RoleOccupant[] = { OID_ATTR_TYPE, 33 },
89 OID_SeeAlso[] = { OID_ATTR_TYPE, 34 },
90 OID_UserPassword[] = { OID_ATTR_TYPE, 35 },
91 OID_UserCertificate[] = { OID_ATTR_TYPE, 36 },
92 OID_CACertificate[] = { OID_ATTR_TYPE, 37 },
93 OID_AuthorityRevocationList[] = { OID_ATTR_TYPE, 38 },
94 OID_CertificateRevocationList[] = { OID_ATTR_TYPE, 39 },
95 OID_CrossCertificatePair[] = { OID_ATTR_TYPE, 40 },
96 OID_Name[] = { OID_ATTR_TYPE, 41 },
97 OID_GivenName[] = { OID_ATTR_TYPE, 42 },
98 OID_Initials[] = { OID_ATTR_TYPE, 43 },
99 OID_GenerationQualifier[] = { OID_ATTR_TYPE, 44 },
100 OID_UniqueIdentifier[] = { OID_ATTR_TYPE, 45 },
101 OID_DNQualifier[] = { OID_ATTR_TYPE, 46 },
102 OID_EnhancedSearchGuide[] = { OID_ATTR_TYPE, 47 },
103 OID_ProtocolInformation[] = { OID_ATTR_TYPE, 48 },
104 OID_DistinguishedName[] = { OID_ATTR_TYPE, 49 },
105 OID_UniqueMember[] = { OID_ATTR_TYPE, 50 },
106 OID_HouseIdentifier[] = { OID_ATTR_TYPE, 51 }
107 ;
108
109 const SecAsn1Oid
110 CSSMOID_ObjectClass = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_ObjectClass},
111 CSSMOID_AliasedEntryName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_AliasedEntryName},
112 CSSMOID_KnowledgeInformation = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_KnowledgeInformation},
113 CSSMOID_CommonName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_CommonName},
114 CSSMOID_Surname = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Surname},
115 CSSMOID_SerialNumber = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_SerialNumber},
116 CSSMOID_CountryName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_CountryName},
117 CSSMOID_LocalityName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_LocalityName},
118 CSSMOID_StateProvinceName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_StateProvinceName},
119 CSSMOID_CollectiveStateProvinceName
120 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveStateProvinceName},
121 CSSMOID_StreetAddress = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_StreetAddress},
122 CSSMOID_CollectiveStreetAddress = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveStreetAddress},
123 CSSMOID_OrganizationName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_OrganizationName},
124 CSSMOID_CollectiveOrganizationName
125 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveOrganizationName},
126 CSSMOID_OrganizationalUnitName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_OrganizationalUnitName},
127 CSSMOID_CollectiveOrganizationalUnitName
128 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveOrganizationalUnitName},
129 CSSMOID_Title = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Title},
130 CSSMOID_Description = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Description},
131 CSSMOID_SearchGuide = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_SearchGuide},
132 CSSMOID_BusinessCategory = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_BusinessCategory},
133 CSSMOID_PostalAddress = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PostalAddress},
134 CSSMOID_CollectivePostalAddress = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectivePostalAddress},
135 CSSMOID_PostalCode = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PostalCode},
136 CSSMOID_CollectivePostalCode = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectivePostalCode},
137 CSSMOID_PostOfficeBox = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PostOfficeBox},
138 CSSMOID_CollectivePostOfficeBox = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectivePostOfficeBox},
139 CSSMOID_PhysicalDeliveryOfficeName
140 = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PhysicalDeliveryOfficeName},
141 CSSMOID_CollectivePhysicalDeliveryOfficeName
142 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectivePhysicalDeliveryOfficeName},
143 CSSMOID_TelephoneNumber = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_TelephoneNumber},
144 CSSMOID_CollectiveTelephoneNumber
145 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveTelephoneNumber},
146 CSSMOID_TelexNumber = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_TelexNumber},
147 CSSMOID_CollectiveTelexNumber = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveTelexNumber},
148 CSSMOID_TelexTerminalIdentifier = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_TelexTerminalIdentifier},
149 CSSMOID_CollectiveTelexTerminalIdentifier
150 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveTelexTerminalIdentifier},
151 CSSMOID_FacsimileTelephoneNumber= { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_FacsimileTelephoneNumber},
152 CSSMOID_CollectiveFacsimileTelephoneNumber
153 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveFacsimileTelephoneNumber},
154 CSSMOID_X_121Address = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_X_121Address},
155 CSSMOID_InternationalISDNNumber = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_InternationalISDNNumber},
156 CSSMOID_CollectiveInternationalISDNNumber
157 = { OID_ATTR_TYPE_LENGTH+2, (uint8_t *)OID_CollectiveInternationalISDNNumber},
158 CSSMOID_RegisteredAddress = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_RegisteredAddress},
159 CSSMOID_DestinationIndicator = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_DestinationIndicator},
160 CSSMOID_PreferredDeliveryMethod = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PreferredDeliveryMethod},
161 CSSMOID_PresentationAddress = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_PresentationAddress},
162 CSSMOID_SupportedApplicationContext
163 = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_SupportedApplicationContext},
164 CSSMOID_Member = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Member},
165 CSSMOID_Owner = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Owner},
166 CSSMOID_RoleOccupant = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_RoleOccupant},
167 CSSMOID_SeeAlso = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_SeeAlso},
168 CSSMOID_UserPassword = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_UserPassword},
169 CSSMOID_UserCertificate = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_UserCertificate},
170 CSSMOID_CACertificate = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_CACertificate},
171 CSSMOID_AuthorityRevocationList = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_AuthorityRevocationList},
172 CSSMOID_CertificateRevocationList
173 = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_CertificateRevocationList},
174 CSSMOID_CrossCertificatePair = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_CrossCertificatePair},
175 CSSMOID_Name = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Name},
176 CSSMOID_GivenName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_GivenName},
177 CSSMOID_Initials = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_Initials},
178 CSSMOID_GenerationQualifier = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_GenerationQualifier},
179 CSSMOID_UniqueIdentifier = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_UniqueIdentifier},
180 CSSMOID_DNQualifier = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_DNQualifier},
181 CSSMOID_EnhancedSearchGuide = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_EnhancedSearchGuide},
182 CSSMOID_ProtocolInformation = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_ProtocolInformation},
183 CSSMOID_DistinguishedName = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_DistinguishedName},
184 CSSMOID_UniqueMember = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_UniqueMember},
185 CSSMOID_HouseIdentifier = { OID_ATTR_TYPE_LENGTH+1, (uint8_t *)OID_HouseIdentifier}
186 ;
187
188
189 /* From PKCS 9 */
190 static const uint8_t
191 OID_EmailAddress[] = { OID_PKCS_9, 1 },
192 OID_UnstructuredName[] = { OID_PKCS_9, 2 },
193 OID_ContentType[] = { OID_PKCS_9, 3 },
194 OID_MessageDigest[] = { OID_PKCS_9, 4 },
195 OID_SigningTime[] = { OID_PKCS_9, 5 },
196 OID_CounterSignature[] = { OID_PKCS_9, 6 },
197 OID_ChallengePassword[] = { OID_PKCS_9, 7 },
198 OID_UnstructuredAddress[] = { OID_PKCS_9, 8 },
199 OID_ExtendedCertificateAttributes[] = { OID_PKCS_9, 9 }
200 ;
201
202 const SecAsn1Oid
203 CSSMOID_EmailAddress = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_EmailAddress},
204 CSSMOID_UnstructuredName = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_UnstructuredName},
205 CSSMOID_ContentType = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_ContentType},
206 CSSMOID_MessageDigest = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_MessageDigest},
207 CSSMOID_SigningTime = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_SigningTime},
208 CSSMOID_CounterSignature = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_CounterSignature},
209 CSSMOID_ChallengePassword = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_ChallengePassword},
210 CSSMOID_UnstructuredAddress = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_UnstructuredAddress},
211 CSSMOID_ExtendedCertificateAttributes = {OID_PKCS_9_LENGTH+1, (uint8_t *)OID_ExtendedCertificateAttributes};
212
213 /* PKIX */
214 static const uint8_t
215 OID_QT_CPS[] = { OID_QT, 1 },
216 OID_QT_UNOTICE[] = { OID_QT, 2 },
217 _OID_AD_OCSP[] = { OID_AD_OCSP },
218 OID_AD_CA_ISSUERS[] = { OID_AD, 2 },
219 OID_AD_TIME_STAMPING[] = { OID_AD, 3 },
220 OID_AD_CA_REPOSITORY[] = { OID_AD, 5 },
221 OID_PDA_DATE_OF_BIRTH[] = { OID_PDA, 1 },
222 OID_PDA_PLACE_OF_BIRTH[] = { OID_PDA, 2 },
223 OID_PDA_GENDER[] = { OID_PDA, 3 },
224 OID_PDA_COUNTRY_CITIZEN[] = { OID_PDA, 4 },
225 OID_PDA_COUNTRY_RESIDENCE[] = { OID_PDA, 5 },
226 OID_QCS_SYNTAX_V1[] = { OID_QCS, 1 },
227 OID_QCS_SYNTAX_V2[] = { OID_QCS, 2 }
228 ;
229
230 /* ETSI */
231 static const uint8_t
232 OID_ETSI_QCS_QC_COMPLICANCE[] = { OID_ETSI_QCS, 1 },
233 OID_ETSI_QCS_QC_LIMIT_VALUE[] = { OID_ETSI_QCS, 2 },
234 __unused OID_ETSI_QCS_QC_RETENTION[] = { OID_ETSI_QCS, 3 },
235 __unused OID_ETSI_QCS_QC_SSCD[] = { OID_ETSI_QCS, 4 }
236 ;
237
238 const SecAsn1Oid
239 CSSMOID_QT_CPS = {OID_QT_LENGTH+1, (uint8_t *)OID_QT_CPS},
240 CSSMOID_QT_UNOTICE = {OID_QT_LENGTH+1, (uint8_t *)OID_QT_UNOTICE},
241 CSSMOID_AD_OCSP = {OID_AD_LENGTH+1, (uint8_t *)_OID_AD_OCSP},
242 CSSMOID_AD_CA_ISSUERS = {OID_AD_LENGTH+1, (uint8_t *)OID_AD_CA_ISSUERS},
243 CSSMOID_AD_TIME_STAMPING = {OID_AD_LENGTH+1, (uint8_t *)OID_AD_TIME_STAMPING},
244 CSSMOID_AD_CA_REPOSITORY = {OID_AD_LENGTH+1, (uint8_t *)OID_AD_CA_REPOSITORY},
245 CSSMOID_PDA_DATE_OF_BIRTH = {OID_PDA_LENGTH+1, (uint8_t *)OID_PDA_DATE_OF_BIRTH},
246 CSSMOID_PDA_PLACE_OF_BIRTH = {OID_PDA_LENGTH+1, (uint8_t *)OID_PDA_PLACE_OF_BIRTH},
247 CSSMOID_PDA_GENDER = {OID_PDA_LENGTH+1, (uint8_t *)OID_PDA_GENDER},
248 CSSMOID_PDA_COUNTRY_CITIZEN = {OID_PDA_LENGTH+1, (uint8_t *)OID_PDA_COUNTRY_CITIZEN},
249 CSSMOID_PDA_COUNTRY_RESIDENCE = {OID_PDA_LENGTH+1, (uint8_t *)OID_PDA_COUNTRY_RESIDENCE},
250 CSSMOID_OID_QCS_SYNTAX_V1 = {OID_QCS_LENGTH+1, (uint8_t *)OID_QCS_SYNTAX_V1},
251 CSSMOID_OID_QCS_SYNTAX_V2 = {OID_QCS_LENGTH+1, (uint8_t *)OID_QCS_SYNTAX_V2}
252 ;
253
254 const SecAsn1Oid
255 CSSMOID_ETSI_QCS_QC_COMPLIANCE = {OID_ETSI_QCS_LENGTH + 1,
256 (uint8_t *)OID_ETSI_QCS_QC_COMPLICANCE},
257 CSSMOID_ETSI_QCS_QC_LIMIT_VALUE = {OID_ETSI_QCS_LENGTH + 1,
258 (uint8_t *)OID_ETSI_QCS_QC_LIMIT_VALUE},
259 CSSMOID_ETSI_QCS_QC_RETENTION = {OID_ETSI_QCS_LENGTH + 1,
260 (uint8_t *)OID_ETSI_QCS_QC_COMPLICANCE},
261 CSSMOID_ETSI_QCS_QC_SSCD = {OID_ETSI_QCS_LENGTH + 1,
262 (uint8_t *)OID_ETSI_QCS_QC_COMPLICANCE}
263 ;
264
265 #define OID_PKCS12_BagTypes OID_PKCS_12,10,1
266 #define OID_PKCS12_BagTypesLength OID_PKCS_12_LENGTH+2
267
268 #define ID_PKCS9_CertTypes OID_PKCS_9, 22
269 #define OID_PKCS9_CertTypesLength OID_PKCS_9_LENGTH+1
270 #define ID_PKCS9_CrlTypes OID_PKCS_9, 23
271 #define OID_PKCS9_CrlTypesLength OID_PKCS_9_LENGTH+1
272
273 static const uint8_t
274 OID_PKCS7_Data[] = { OID_PKCS_7, 1},
275 OID_PKCS7_SignedData[] = { OID_PKCS_7, 2},
276 OID_PKCS7_EnvelopedData[] = { OID_PKCS_7, 3},
277 OID_PKCS7_SignedAndEnvelopedData[] = { OID_PKCS_7, 4},
278 OID_PKCS7_DigestedData[] = { OID_PKCS_7, 5},
279 OID_PKCS7_EncryptedData[] = { OID_PKCS_7, 6},
280 OID_PKCS7_DataWithAttributes[] = { OID_PKCS_7, 7},
281 OID_PKCS7_EncryptedPrivateKeyInfo[] = { OID_PKCS_7, 8},
282
283 OID_PKCS9_FriendlyName[] = { OID_PKCS_9, 20},
284 OID_PKCS9_LocalKeyId[] = { OID_PKCS_9, 21},
285 OID_PKCS9_CertTypes[] = { ID_PKCS9_CertTypes },
286 OID_PKCS9_CrlTypes[] = { ID_PKCS9_CrlTypes },
287 OID_PKCS9_X509Certificate[] = { ID_PKCS9_CertTypes, 1 },
288 OID_PKCS9_SdsiCertificate[] = { ID_PKCS9_CertTypes, 2 },
289 OID_PKCS9_X509Crl[] = { ID_PKCS9_CrlTypes, 1 },
290
291 OID_PKCS12_keyBag[] = { OID_PKCS12_BagTypes, 1},
292 OID_PKCS12_shroundedKeyBag[] = { OID_PKCS12_BagTypes, 2},
293 OID_PKCS12_certBag[] = { OID_PKCS12_BagTypes, 3},
294 OID_PKCS12_crlBag[] = { OID_PKCS12_BagTypes, 4},
295 OID_PKCS12_secretBag[] = { OID_PKCS12_BagTypes, 5},
296 OID_PKCS12_safeContentsBag[] = { OID_PKCS12_BagTypes, 6}
297 ;
298
299 /*
300 -- ContentTypes
301 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1)}
302
303 -- Attributes
304 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) aa(2)}
305
306 -- eContentType for a time-stamp token
307
308 id-ct-TSTInfo OBJECT IDENTIFIER ::= { iso(1) member-body(2)
309 us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1) 4}
310
311 id-aa-timeStampToken OBJECT IDENTIFIER ::= { iso(1) member-body(2)
312 us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) aa(2) 14 }
313 */
314
315 #define ID_PKCS9_SMIME OID_PKCS_9, 16
316 #define OID_PKCS9_SMIMELength OID_PKCS_9_LENGTH+1
317 #define ID_PKCS9_CONTENT_TYPES ID_PKCS9_SMIME, 1
318 #define OID_PKCS9_CT_Length OID_PKCS9_SMIMELength+1
319 #define ID_PKCS9_ATTRIBUTES ID_PKCS9_SMIME, 2
320 #define OID_PKCS9_Attrs_Length OID_PKCS9_SMIMELength+1
321
322 static const uint8_t
323 OID_ID_CT_TSTInfo[] = { ID_PKCS9_CONTENT_TYPES, 4 },
324 OID_TimeStampToken[] = { ID_PKCS9_ATTRIBUTES, 14 };
325
326 const SecAsn1Oid
327 CSSMOID_PKCS9_Id_Ct_TSTInfo = {OID_PKCS9_CT_Length + 1,
328 (uint8_t *)OID_ID_CT_TSTInfo },
329 CSSMOID_PKCS9_TimeStampToken = {OID_PKCS9_Attrs_Length + 1,
330 (uint8_t *)OID_TimeStampToken };
331
332
333 const SecAsn1Oid
334 CSSMOID_PKCS7_Data = {OID_PKCS_7_LENGTH + 1,
335 (uint8_t *)OID_PKCS7_Data },
336 CSSMOID_PKCS7_SignedData = {OID_PKCS_7_LENGTH + 1,
337 (uint8_t *)OID_PKCS7_SignedData },
338 CSSMOID_PKCS7_EnvelopedData = {OID_PKCS_7_LENGTH + 1,
339 (uint8_t *)OID_PKCS7_EnvelopedData },
340 CSSMOID_PKCS7_SignedAndEnvelopedData = {OID_PKCS_7_LENGTH + 1,
341 (uint8_t *)OID_PKCS7_SignedAndEnvelopedData },
342 CSSMOID_PKCS7_DigestedData = {OID_PKCS_7_LENGTH + 1,
343 (uint8_t *)OID_PKCS7_DigestedData },
344 CSSMOID_PKCS7_EncryptedData = {OID_PKCS_7_LENGTH + 1,
345 (uint8_t *)OID_PKCS7_EncryptedData },
346 CSSMOID_PKCS7_DataWithAttributes = {OID_PKCS_7_LENGTH + 1,
347 (uint8_t *)OID_PKCS7_DataWithAttributes },
348 CSSMOID_PKCS7_EncryptedPrivateKeyInfo = {OID_PKCS_7_LENGTH + 1,
349 (uint8_t *)OID_PKCS7_EncryptedPrivateKeyInfo },
350
351 CSSMOID_PKCS9_FriendlyName = {OID_PKCS_9_LENGTH + 1,
352 (uint8_t *)OID_PKCS9_FriendlyName },
353 CSSMOID_PKCS9_LocalKeyId = {OID_PKCS_9_LENGTH + 1,
354 (uint8_t *)OID_PKCS9_LocalKeyId },
355 CSSMOID_PKCS9_CertTypes = {OID_PKCS_9_LENGTH + 1,
356 (uint8_t *)OID_PKCS9_CertTypes },
357 CSSMOID_PKCS9_CrlTypes = {OID_PKCS_9_LENGTH + 1,
358 (uint8_t *)OID_PKCS9_CrlTypes },
359 CSSMOID_PKCS9_X509Certificate = {OID_PKCS9_CertTypesLength + 1,
360 (uint8_t *)OID_PKCS9_X509Certificate },
361 CSSMOID_PKCS9_SdsiCertificate = {OID_PKCS9_CertTypesLength + 1,
362 (uint8_t *)OID_PKCS9_SdsiCertificate },
363 CSSMOID_PKCS9_X509Crl = {OID_PKCS9_CrlTypesLength + 1,
364 (uint8_t *)OID_PKCS9_X509Crl },
365
366
367 CSSMOID_PKCS12_keyBag = {OID_PKCS12_BagTypesLength + 1,
368 (uint8_t *)OID_PKCS12_keyBag },
369 CSSMOID_PKCS12_shroudedKeyBag = {OID_PKCS12_BagTypesLength + 1,
370 (uint8_t *)OID_PKCS12_shroundedKeyBag },
371 CSSMOID_PKCS12_certBag = {OID_PKCS12_BagTypesLength + 1,
372 (uint8_t *)OID_PKCS12_certBag },
373 CSSMOID_PKCS12_crlBag = {OID_PKCS12_BagTypesLength + 1,
374 (uint8_t *)OID_PKCS12_crlBag },
375 CSSMOID_PKCS12_secretBag = {OID_PKCS12_BagTypesLength + 1,
376 (uint8_t *)OID_PKCS12_secretBag },
377 CSSMOID_PKCS12_safeContentsBag = {OID_PKCS12_BagTypesLength + 1,
378 (uint8_t *)OID_PKCS12_safeContentsBag }
379
380 ;
381
382 /* Kerberos PKINIT CMS ContentInfo types */
383
384 static const uint8_t
385 OID_KERBv5_PKINIT_AUTH_DATA[] = { OID_KERBv5_PKINIT, 1 },
386 OID_KERBv5_PKINIT_DH_KEY_DATA[] = { OID_KERBv5_PKINIT, 2 },
387 OID_KERBv5_PKINIT_RKEY_DATA[] = { OID_KERBv5_PKINIT, 3 };
388
389 const SecAsn1Oid
390 CSSMOID_KERBv5_PKINIT_AUTH_DATA = { OID_KERBv5_PKINIT_LEN + 1,
391 (uint8_t *)OID_KERBv5_PKINIT_AUTH_DATA },
392 CSSMOID_KERBv5_PKINIT_DH_KEY_DATA = { OID_KERBv5_PKINIT_LEN + 1,
393 (uint8_t *)OID_KERBv5_PKINIT_DH_KEY_DATA },
394 CSSMOID_KERBv5_PKINIT_RKEY_DATA = { OID_KERBv5_PKINIT_LEN + 1,
395 (uint8_t *)OID_KERBv5_PKINIT_RKEY_DATA };
396
397 /*
398 * Additional OIDS for LDAP support
399 */
400
401 static const uint8_t
402 OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_USERID_Data[] = {OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_USERID};
403
404 const SecAsn1Oid
405 CSSMOID_UserID = {OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_USERID_LENGTH, (uint8_t *)OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_USERID_Data};
406
407 static const uint8_t
408 OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_DOMAINCOMPONENT_Data[] = {OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_DOMAINCOMPONENT};
409
410 const SecAsn1Oid
411 CSSMOID_DomainComponent = {OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_DOMAINCOMPONENT_LENGTH, (uint8_t *)OID_ITU_RFCDATA_2342_UCL_DIRECTORYPILOT_ATTRIBUTES_DOMAINCOMPONENT_Data};
412
413 /* ANSI X9.62 and Certicom elliptic curve OIDs */
414 static const uint8_t
415 OID_X9_62[] = { OID_ANSI_X9_62 },
416 OID_X9_62_FieldType[] = { OID_ANSI_X9_62_FIELD_TYPE },
417 OID_X9_62_PubKeyType[] = { OID_ANSI_X9_62_PUBKEY_TYPE },
418 OID_X9_62_EllCurve[] = { OID_ANSI_X9_62_ELL_CURVE },
419 OID_X9_62_C_TwoCurve[] = { OID_ANSI_X9_62_C_TWO_CURVE },
420 OID_X9_62_PrimeCurve[] = { OID_ANSI_X9_62_PRIME_CURVE },
421 OID_X9_62_SigType[] = { OID_ANSI_X9_62_SIG_TYPE },
422
423 /* these two defined in ANSI X9.62 but renamed in common usage */
424 OID_secp192r1[] = { OID_ANSI_X9_62_PRIME_CURVE, 1 },
425 OID_secp256r1[] = { OID_ANSI_X9_62_PRIME_CURVE, 7 },
426 /* remainder defined in Certicom SEC 2 */
427 OID_Certicom[] = { OID_CERTICOM },
428 OID_CerticomEllCurve[] = { OID_CERTICOM_ELL_CURVE },
429 /* curves over prime-order fields */
430 OID_secp112r1[] = { OID_CERTICOM_ELL_CURVE, 6 },
431 OID_secp112r2[] = { OID_CERTICOM_ELL_CURVE, 7 },
432 OID_secp128r1[] = { OID_CERTICOM_ELL_CURVE, 28 },
433 OID_secp128r2[] = { OID_CERTICOM_ELL_CURVE, 29 },
434 OID_secp160k1[] = { OID_CERTICOM_ELL_CURVE, 9 },
435 OID_secp160r1[] = { OID_CERTICOM_ELL_CURVE, 8 },
436 OID_secp160r2[] = { OID_CERTICOM_ELL_CURVE, 30 },
437 OID_secp192k1[] = { OID_CERTICOM_ELL_CURVE, 31 },
438 OID_secp224k1[] = { OID_CERTICOM_ELL_CURVE, 32 },
439 OID_secp224r1[] = { OID_CERTICOM_ELL_CURVE, 33 },
440 OID_secp256k1[] = { OID_CERTICOM_ELL_CURVE, 10 },
441 OID_secp384r1[] = { OID_CERTICOM_ELL_CURVE, 34 },
442 OID_secp521r1[] = { OID_CERTICOM_ELL_CURVE, 35 },
443 /* curves over characteristic 2 fields */
444 OID_sect113r1[] = { OID_CERTICOM_ELL_CURVE, 4 },
445 OID_sect113r2[] = { OID_CERTICOM_ELL_CURVE, 5 },
446 OID_sect131r1[] = { OID_CERTICOM_ELL_CURVE, 22 },
447 OID_sect131r2[] = { OID_CERTICOM_ELL_CURVE, 23 },
448 OID_sect163k1[] = { OID_CERTICOM_ELL_CURVE, 1 },
449 OID_sect163r1[] = { OID_CERTICOM_ELL_CURVE, 2 },
450 OID_sect163r2[] = { OID_CERTICOM_ELL_CURVE, 15 },
451 OID_sect193r1[] = { OID_CERTICOM_ELL_CURVE, 24 },
452 OID_sect193r2[] = { OID_CERTICOM_ELL_CURVE, 25 },
453 OID_sect233k1[] = { OID_CERTICOM_ELL_CURVE, 26 },
454 OID_sect233r1[] = { OID_CERTICOM_ELL_CURVE, 27 },
455 OID_sect239k1[] = { OID_CERTICOM_ELL_CURVE, 3 },
456 OID_sect283k1[] = { OID_CERTICOM_ELL_CURVE, 16 },
457 OID_sect283r1[] = { OID_CERTICOM_ELL_CURVE, 17 },
458 OID_sect409k1[] = { OID_CERTICOM_ELL_CURVE, 36 },
459 OID_sect409r1[] = { OID_CERTICOM_ELL_CURVE, 37 },
460 OID_sect571k1[] = { OID_CERTICOM_ELL_CURVE, 38 },
461 OID_sect571r1[] = { OID_CERTICOM_ELL_CURVE, 39 }
462 ;
463
464 const SecAsn1Oid
465 CSSMOID_X9_62 = {OID_ANSI_X9_42_LEN, (uint8_t *)OID_X9_62 },
466 CSSMOID_X9_62_FieldType = {OID_ANSI_X9_42_LEN+1, (uint8_t *)OID_X9_62_FieldType },
467 CSSMOID_X9_62_PubKeyType = {OID_ANSI_X9_42_LEN+1, (uint8_t *)OID_X9_62_PubKeyType },
468 CSSMOID_X9_62_EllCurve = {OID_ANSI_X9_42_LEN+1, (uint8_t *)OID_X9_62_EllCurve },
469 CSSMOID_X9_62_C_TwoCurve = {OID_ANSI_X9_62_ELL_CURVE_LEN+1, (uint8_t *)OID_X9_62_C_TwoCurve },
470 CSSMOID_X9_62_PrimeCurve = {OID_ANSI_X9_62_ELL_CURVE_LEN+1, (uint8_t *)OID_X9_62_PrimeCurve },
471 CSSMOID_X9_62_SigType = {OID_ANSI_X9_42_LEN+1, (uint8_t *)OID_X9_62_SigType },
472 CSSMOID_secp192r1 = {OID_ANSI_X9_62_ELL_CURVE_LEN+2, (uint8_t *)OID_secp192r1 },
473 CSSMOID_secp256r1 = {OID_ANSI_X9_62_ELL_CURVE_LEN+2, (uint8_t *)OID_secp256r1 },
474 CSSMOID_Certicom = {OID_CERTICOM_LEN, (uint8_t *)OID_Certicom },
475 CSSMOID_CerticomEllCurve = {OID_CERTICOM_ELL_CURVE_LEN, (uint8_t *)OID_CerticomEllCurve },
476 CSSMOID_secp112r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp112r1 },
477 CSSMOID_secp112r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp112r2 },
478 CSSMOID_secp128r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp128r1 },
479 CSSMOID_secp128r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp128r2 },
480 CSSMOID_secp160k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp160k1 },
481 CSSMOID_secp160r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp160r1 },
482 CSSMOID_secp160r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp160r2 },
483 CSSMOID_secp192k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp192k1 },
484 CSSMOID_secp224k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp224k1 },
485 CSSMOID_secp224r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp224r1 },
486 CSSMOID_secp256k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp256k1 },
487 CSSMOID_secp384r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp384r1 },
488 CSSMOID_secp521r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_secp521r1 },
489 CSSMOID_sect113r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect113r1 },
490 CSSMOID_sect113r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect113r2 },
491 CSSMOID_sect131r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect131r1 },
492 CSSMOID_sect131r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect131r2 },
493 CSSMOID_sect163k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect163k1 },
494 CSSMOID_sect163r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect163r1 },
495 CSSMOID_sect163r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect163r2 },
496 CSSMOID_sect193r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect193r1 },
497 CSSMOID_sect193r2 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect193r2 },
498 CSSMOID_sect233k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect233k1 },
499 CSSMOID_sect233r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect233r1 },
500 CSSMOID_sect239k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect239k1 },
501 CSSMOID_sect283k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect283k1 },
502 CSSMOID_sect283r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect283r1 },
503 CSSMOID_sect409k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect409k1 },
504 CSSMOID_sect409r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect409r1 },
505 CSSMOID_sect571k1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect571k1 },
506 CSSMOID_sect571r1 = {OID_CERTICOM_ELL_CURVE_LEN+1, (uint8_t *)OID_sect571r1 };