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 typedef uint8 CSSM_BER_TAG
;
36 #define BER_TAG_UNKNOWN 0
37 #define BER_TAG_BOOLEAN 1
38 #define BER_TAG_INTEGER 2
39 #define BER_TAG_BIT_STRING 3
40 #define BER_TAG_OCTET_STRING 4
41 #define BER_TAG_NULL 5
43 #define BER_TAG_OBJECT_DESCRIPTOR 7
44 #define BER_TAG_EXTERNAL 8
45 #define BER_TAG_REAL 9
46 #define BER_TAG_ENUMERATED 10
47 /* 12 to 15 are reserved for future versions of the recommendation */
48 #define BER_TAG_PKIX_UTF8_STRING 12
49 #define BER_TAG_SEQUENCE 16
50 #define BER_TAG_SET 17
51 #define BER_TAG_NUMERIC_STRING 18
52 #define BER_TAG_PRINTABLE_STRING 19
53 #define BER_TAG_T61_STRING 20
54 #define BER_TAG_TELETEX_STRING BER_TAG_T61_STRING
55 #define BER_TAG_VIDEOTEX_STRING 21
56 #define BER_TAG_IA5_STRING 22
57 #define BER_TAG_UTC_TIME 23
58 #define BER_TAG_GENERALIZED_TIME 24
59 #define BER_TAG_GRAPHIC_STRING 25
60 #define BER_TAG_ISO646_STRING 26
61 #define BER_TAG_GENERAL_STRING 27
62 #define BER_TAG_VISIBLE_STRING BER_TAG_ISO646_STRING
63 /* 28 - are reserved for future versions of the recommendation */
64 #define BER_TAG_PKIX_UNIVERSAL_STRING 28
65 #define BER_TAG_PKIX_BMP_STRING 30
68 /* Data Structures for X.509 Certificates */
70 typedef struct cssm_x509_algorithm_identifier
{
73 } 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
;
75 /* X509 Distinguished name structure */
76 typedef struct cssm_x509_type_value_pair
{
78 CSSM_BER_TAG valueType
; /* The Tag to be used when */
79 /*this value is BER encoded */
81 } 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
;
83 typedef struct cssm_x509_rdn
{
85 CSSM_X509_TYPE_VALUE_PAIR_PTR AttributeTypeAndValue
;
86 } 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
;
88 typedef struct cssm_x509_name
{
90 CSSM_X509_RDN_PTR RelativeDistinguishedName
;
91 } 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
;
93 /* Public key info struct */
94 typedef struct cssm_x509_subject_public_key_info
{
95 CSSM_X509_ALGORITHM_IDENTIFIER algorithm
;
96 CSSM_DATA subjectPublicKey
;
97 } 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
;
99 typedef struct cssm_x509_time
{
100 CSSM_BER_TAG timeType
;
102 } 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
;
104 /* Validity struct */
105 typedef struct x509_validity
{
106 CSSM_X509_TIME notBefore
;
107 CSSM_X509_TIME notAfter
;
108 } 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
;
110 #define CSSM_X509_OPTION_PRESENT CSSM_TRUE
111 #define CSSM_X509_OPTION_NOT_PRESENT CSSM_FALSE
112 typedef CSSM_BOOL CSSM_X509_OPTION
;
114 typedef struct cssm_x509ext_basicConstraints
{
116 CSSM_X509_OPTION pathLenConstraintPresent
;
117 uint32 pathLenConstraint
;
118 } 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
;
120 typedef enum extension_data_format
{
121 CSSM_X509_DATAFORMAT_ENCODED
= 0,
122 CSSM_X509_DATAFORMAT_PARSED
,
123 CSSM_X509_DATAFORMAT_PAIR
124 } CSSM_X509EXT_DATA_FORMAT
;
126 typedef struct cssm_x509_extensionTagAndValue
{
129 } 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
;
131 typedef struct cssm_x509ext_pair
{
132 CSSM_X509EXT_TAGandVALUE tagAndValue
;
134 } 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
;
136 /* Extension structure */
137 typedef struct cssm_x509_extension
{
140 CSSM_X509EXT_DATA_FORMAT format
;
141 union cssm_x509ext_value
{
142 CSSM_X509EXT_TAGandVALUE
*tagAndValue
;
144 CSSM_X509EXT_PAIR
*valuePair
;
147 } 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
;
149 typedef struct cssm_x509_extensions
{
150 uint32 numberOfExtensions
;
151 CSSM_X509_EXTENSION_PTR extensions
;
152 } 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
;
154 /* X509V3 certificate structure */
155 typedef struct cssm_x509_tbs_certificate
{
157 CSSM_DATA serialNumber
;
158 CSSM_X509_ALGORITHM_IDENTIFIER signature
;
159 CSSM_X509_NAME issuer
;
160 CSSM_X509_VALIDITY validity
;
161 CSSM_X509_NAME subject
;
162 CSSM_X509_SUBJECT_PUBLIC_KEY_INFO subjectPublicKeyInfo
;
163 CSSM_DATA issuerUniqueIdentifier
;
164 CSSM_DATA subjectUniqueIdentifier
;
165 CSSM_X509_EXTENSIONS extensions
;
166 } 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
;
168 /* Signature structure */
169 typedef struct cssm_x509_signature
{
170 CSSM_X509_ALGORITHM_IDENTIFIER algorithmIdentifier
;
172 } 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
;
174 /* Signed certificate structure */
175 typedef struct cssm_x509_signed_certificate
{
176 CSSM_X509_TBS_CERTIFICATE certificate
;
177 CSSM_X509_SIGNATURE signature
;
178 } 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
;
180 typedef struct cssm_x509ext_policyQualifierInfo
{
181 CSSM_OID policyQualifierId
;
183 } 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
;
185 typedef struct cssm_x509ext_policyQualifiers
{
186 uint32 numberOfPolicyQualifiers
;
187 CSSM_X509EXT_POLICYQUALIFIERINFO
*policyQualifier
;
188 } 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
;
190 typedef struct cssm_x509ext_policyInfo
{
191 CSSM_OID policyIdentifier
;
192 CSSM_X509EXT_POLICYQUALIFIERS policyQualifiers
;
193 } 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
;
196 /* Data Structures for X.509 Certificate Revocations Lists */
198 /* x509V2 entry in the CRL revokedCertificates sequence */
199 typedef struct cssm_x509_revoked_cert_entry
{
200 CSSM_DATA certificateSerialNumber
;
201 CSSM_X509_TIME revocationDate
;
202 CSSM_X509_EXTENSIONS extensions
;
203 } 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
;
205 typedef struct cssm_x509_revoked_cert_list
{
206 uint32 numberOfRevokedCertEntries
;
207 CSSM_X509_REVOKED_CERT_ENTRY_PTR revokedCertEntry
;
208 } 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
;
210 /* x509v2 Certificate Revocation List (CRL) (unsigned) structure */
211 typedef struct cssm_x509_tbs_certlist
{
213 CSSM_X509_ALGORITHM_IDENTIFIER signature
;
214 CSSM_X509_NAME issuer
;
215 CSSM_X509_TIME thisUpdate
;
216 CSSM_X509_TIME nextUpdate
;
217 CSSM_X509_REVOKED_CERT_LIST_PTR revokedCertificates
;
218 CSSM_X509_EXTENSIONS extensions
;
219 } 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
;
221 typedef struct cssm_x509_signed_crl
{
222 CSSM_X509_TBS_CERTLIST tbsCertList
;
223 CSSM_X509_SIGNATURE signature
;
224 } 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
;
230 #endif /* _X509DEFS_H_ */