2 * Copyright (c) 1999-2002,2004,2011,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
23 * x509defs.h -- Data structures for X509 Certificate Library field values
27 #define _X509DEFS_H_ 1
29 #include <Security/cssmtype.h>
35 #pragma clang diagnostic push
36 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
38 typedef uint8 CSSM_BER_TAG
;
39 #define BER_TAG_UNKNOWN 0
40 #define BER_TAG_BOOLEAN 1
41 #define BER_TAG_INTEGER 2
42 #define BER_TAG_BIT_STRING 3
43 #define BER_TAG_OCTET_STRING 4
44 #define BER_TAG_NULL 5
46 #define BER_TAG_OBJECT_DESCRIPTOR 7
47 #define BER_TAG_EXTERNAL 8
48 #define BER_TAG_REAL 9
49 #define BER_TAG_ENUMERATED 10
50 /* 12 to 15 are reserved for future versions of the recommendation */
51 #define BER_TAG_PKIX_UTF8_STRING 12
52 #define BER_TAG_SEQUENCE 16
53 #define BER_TAG_SET 17
54 #define BER_TAG_NUMERIC_STRING 18
55 #define BER_TAG_PRINTABLE_STRING 19
56 #define BER_TAG_T61_STRING 20
57 #define BER_TAG_TELETEX_STRING BER_TAG_T61_STRING
58 #define BER_TAG_VIDEOTEX_STRING 21
59 #define BER_TAG_IA5_STRING 22
60 #define BER_TAG_UTC_TIME 23
61 #define BER_TAG_GENERALIZED_TIME 24
62 #define BER_TAG_GRAPHIC_STRING 25
63 #define BER_TAG_ISO646_STRING 26
64 #define BER_TAG_GENERAL_STRING 27
65 #define BER_TAG_VISIBLE_STRING BER_TAG_ISO646_STRING
66 /* 28 - are reserved for future versions of the recommendation */
67 #define BER_TAG_PKIX_UNIVERSAL_STRING 28
68 #define BER_TAG_PKIX_BMP_STRING 30
71 /* Data Structures for X.509 Certificates */
73 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_algorithm_identifier
{
76 } CSSM_X509_ALGORITHM_IDENTIFIER DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_ALGORITHM_IDENTIFIER_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
78 /* X509 Distinguished name structure */
79 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_type_value_pair
{
81 CSSM_BER_TAG valueType
; /* The Tag to be used when */
82 /*this value is BER encoded */
84 } CSSM_X509_TYPE_VALUE_PAIR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_TYPE_VALUE_PAIR_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
86 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_rdn
{
88 CSSM_X509_TYPE_VALUE_PAIR_PTR AttributeTypeAndValue
;
89 } CSSM_X509_RDN DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_RDN_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
91 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_name
{
93 CSSM_X509_RDN_PTR RelativeDistinguishedName
;
94 } CSSM_X509_NAME DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_NAME_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
96 /* Public key info struct */
97 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_subject_public_key_info
{
98 CSSM_X509_ALGORITHM_IDENTIFIER algorithm
;
99 CSSM_DATA subjectPublicKey
;
100 } CSSM_X509_SUBJECT_PUBLIC_KEY_INFO DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_SUBJECT_PUBLIC_KEY_INFO_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
102 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_time
{
103 CSSM_BER_TAG timeType
;
105 } CSSM_X509_TIME DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_TIME_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
107 /* Validity struct */
108 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER x509_validity
{
109 CSSM_X509_TIME notBefore
;
110 CSSM_X509_TIME notAfter
;
111 } CSSM_X509_VALIDITY DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_VALIDITY_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
113 #define CSSM_X509_OPTION_PRESENT CSSM_TRUE
114 #define CSSM_X509_OPTION_NOT_PRESENT CSSM_FALSE
115 typedef CSSM_BOOL CSSM_X509_OPTION
;
117 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_basicConstraints
{
119 CSSM_X509_OPTION pathLenConstraintPresent
;
120 uint32 pathLenConstraint
;
121 } CSSM_X509EXT_BASICCONSTRAINTS DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_BASICCONSTRAINTS_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
123 typedef enum extension_data_format
{
124 CSSM_X509_DATAFORMAT_ENCODED
= 0,
125 CSSM_X509_DATAFORMAT_PARSED
,
126 CSSM_X509_DATAFORMAT_PAIR
127 } CSSM_X509EXT_DATA_FORMAT
;
129 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_extensionTagAndValue
{
132 } CSSM_X509EXT_TAGandVALUE DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_TAGandVALUE_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
134 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_pair
{
135 CSSM_X509EXT_TAGandVALUE tagAndValue
;
137 } CSSM_X509EXT_PAIR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_PAIR_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
139 /* Extension structure */
140 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_extension
{
143 CSSM_X509EXT_DATA_FORMAT format
;
144 union DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_value
{
145 CSSM_X509EXT_TAGandVALUE
*tagAndValue
;
147 CSSM_X509EXT_PAIR
*valuePair
;
150 } CSSM_X509_EXTENSION DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_EXTENSION_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
152 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_extensions
{
153 uint32 numberOfExtensions
;
154 CSSM_X509_EXTENSION_PTR extensions
;
155 } CSSM_X509_EXTENSIONS DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_EXTENSIONS_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
157 /* X509V3 certificate structure */
158 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_tbs_certificate
{
160 CSSM_DATA serialNumber
;
161 CSSM_X509_ALGORITHM_IDENTIFIER signature
;
162 CSSM_X509_NAME issuer
;
163 CSSM_X509_VALIDITY validity
;
164 CSSM_X509_NAME subject
;
165 CSSM_X509_SUBJECT_PUBLIC_KEY_INFO subjectPublicKeyInfo
;
166 CSSM_DATA issuerUniqueIdentifier
;
167 CSSM_DATA subjectUniqueIdentifier
;
168 CSSM_X509_EXTENSIONS extensions
;
169 } CSSM_X509_TBS_CERTIFICATE DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_TBS_CERTIFICATE_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
171 /* Signature structure */
172 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_signature
{
173 CSSM_X509_ALGORITHM_IDENTIFIER algorithmIdentifier
;
175 } CSSM_X509_SIGNATURE DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_SIGNATURE_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
177 /* Signed certificate structure */
178 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_signed_certificate
{
179 CSSM_X509_TBS_CERTIFICATE certificate
;
180 CSSM_X509_SIGNATURE signature
;
181 } CSSM_X509_SIGNED_CERTIFICATE DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_SIGNED_CERTIFICATE_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
183 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_policyQualifierInfo
{
184 CSSM_OID policyQualifierId
;
186 } CSSM_X509EXT_POLICYQUALIFIERINFO DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_POLICYQUALIFIERINFO_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
188 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_policyQualifiers
{
189 uint32 numberOfPolicyQualifiers
;
190 CSSM_X509EXT_POLICYQUALIFIERINFO
*policyQualifier
;
191 } CSSM_X509EXT_POLICYQUALIFIERS DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_POLICYQUALIFIERS_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
193 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509ext_policyInfo
{
194 CSSM_OID policyIdentifier
;
195 CSSM_X509EXT_POLICYQUALIFIERS policyQualifiers
;
196 } CSSM_X509EXT_POLICYINFO DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509EXT_POLICYINFO_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
199 /* Data Structures for X.509 Certificate Revocations Lists */
201 /* x509V2 entry in the CRL revokedCertificates sequence */
202 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_revoked_cert_entry
{
203 CSSM_DATA certificateSerialNumber
;
204 CSSM_X509_TIME revocationDate
;
205 CSSM_X509_EXTENSIONS extensions
;
206 } CSSM_X509_REVOKED_CERT_ENTRY DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_REVOKED_CERT_ENTRY_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
208 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_revoked_cert_list
{
209 uint32 numberOfRevokedCertEntries
;
210 CSSM_X509_REVOKED_CERT_ENTRY_PTR revokedCertEntry
;
211 } CSSM_X509_REVOKED_CERT_LIST DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_REVOKED_CERT_LIST_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
213 /* x509v2 Certificate Revocation List (CRL) (unsigned) structure */
214 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_tbs_certlist
{
216 CSSM_X509_ALGORITHM_IDENTIFIER signature
;
217 CSSM_X509_NAME issuer
;
218 CSSM_X509_TIME thisUpdate
;
219 CSSM_X509_TIME nextUpdate
;
220 CSSM_X509_REVOKED_CERT_LIST_PTR revokedCertificates
;
221 CSSM_X509_EXTENSIONS extensions
;
222 } CSSM_X509_TBS_CERTLIST DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_TBS_CERTLIST_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
224 typedef struct DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER cssm_x509_signed_crl
{
225 CSSM_X509_TBS_CERTLIST tbsCertList
;
226 CSSM_X509_SIGNATURE signature
;
227 } CSSM_X509_SIGNED_CRL DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
, *CSSM_X509_SIGNED_CRL_PTR DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
;
229 #pragma clang diagnostic pop
235 #endif /* _X509DEFS_H_ */