]> git.saurik.com Git - apple/security.git/blame - OSX/libsecurity_keychain/libDER/libDER/DER_CertCrl.h
Security-57740.1.18.tar.gz
[apple/security.git] / OSX / libsecurity_keychain / libDER / libDER / DER_CertCrl.h
CommitLineData
d8f41ccd 1/*
fa7225c8 2 * Copyright (c) 2005-2016 Apple Inc. All Rights Reserved.
d8f41ccd
A
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
b1ab9ed8
A
24
25/*
26 * DER_CertCrl.h - support for decoding X509 certificates and CRLs
27 *
b1ab9ed8
A
28 */
29
30#ifndef _DER_CERT_CRL_H_
31#define _DER_CERT_CRL_H_
32
b1ab9ed8
A
33#include <libDER/libDER.h>
34#include <libDER/DER_Decode.h>
35
fa7225c8
A
36__BEGIN_DECLS
37
b1ab9ed8
A
38/*
39 * Top level cert or CRL - the two are identical at this level - three
40 * components. The tbs field is saved in full DER form for sig verify.
41 */
42typedef struct {
43 DERItem tbs; /* sequence, DERTBSCert, DER_DEC_SAVE_DER */
44 DERItem sigAlg; /* sequence, DERAlgorithmId */
45 DERItem sig; /* bit string */
46} DERSignedCertCrl;
47
48/* DERItemSpecs to decode into a DERSignedCertCrl */
49extern const DERItemSpec DERSignedCertCrlItemSpecs[];
50extern const DERSize DERNumSignedCertCrlItemSpecs;
51
52/* TBS cert components */
53typedef struct {
54 DERItem version; /* integer, optional, EXPLICIT */
55 DERItem serialNum; /* integer */
56 DERItem tbsSigAlg; /* sequence, DERAlgorithmId */
57 DERItem issuer; /* sequence, TBD */
58 DERItem validity; /* sequence, DERValidity */
59 DERItem subject; /* sequence, TBD */
60 DERItem subjectPubKey; /* sequence, DERSubjPubKeyInfo */
61 DERItem issuerID; /* bit string, optional */
62 DERItem subjectID; /* bit string, optional */
63 DERItem extensions; /* sequence, optional, EXPLICIT */
64} DERTBSCert;
65
66/* DERItemSpecs to decode into a DERTBSCert */
67extern const DERItemSpec DERTBSCertItemSpecs[];
68extern const DERSize DERNumTBSCertItemSpecs;
69
70/*
71 * validity - components can be either UTC or generalized time.
72 * Both are ASN_ANY with DER_DEC_SAVE_DER.
73 */
74typedef struct {
75 DERItem notBefore;
76 DERItem notAfter;
77} DERValidity;
78
79/* DERItemSpecs to decode into a DERValidity */
80extern const DERItemSpec DERValidityItemSpecs[];
81extern const DERSize DERNumValidityItemSpecs;
82
83/* AttributeTypeAndValue components. */
84typedef struct {
85 DERItem type;
86 DERItem value;
87} DERAttributeTypeAndValue;
88
89/* DERItemSpecs to decode into DERAttributeTypeAndValue */
90extern const DERItemSpec DERAttributeTypeAndValueItemSpecs[];
91extern const DERSize DERNumAttributeTypeAndValueItemSpecs;
92
93/* Extension components */
94typedef struct {
95 DERItem extnID;
96 DERItem critical;
97 DERItem extnValue;
98} DERExtension;
99
100/* DERItemSpecs to decode into DERExtension */
101extern const DERItemSpec DERExtensionItemSpecs[];
102extern const DERSize DERNumExtensionItemSpecs;
103
104/* BasicConstraints components. */
105typedef struct {
106 DERItem cA;
107 DERItem pathLenConstraint;
108} DERBasicConstraints;
109
110/* DERItemSpecs to decode into DERBasicConstraints */
111extern const DERItemSpec DERBasicConstraintsItemSpecs[];
112extern const DERSize DERNumBasicConstraintsItemSpecs;
113
5c19dc3a
A
114/* NameConstraints components. */
115typedef struct {
116 DERItem permittedSubtrees;
117 DERItem excludedSubtrees;
118} DERNameConstraints;
119
120/* DERItemSpecs to decode into a DERNameConstraints */
121extern const DERItemSpec DERNameConstraintsItemSpecs[];
122extern const DERSize DERNumNameConstraintsItemSpecs;
123
124/* GeneralSubtree components. */
125typedef struct {
126 DERItem generalName;
127 DERItem minimum;
128 DERItem maximum;
129} DERGeneralSubtree;
130
131/* DERItemSpecs to decode into a DERGeneralSubtree */
132extern const DERItemSpec DERGeneralSubtreeItemSpecs[];
133extern const DERSize DERNumGeneralSubtreeItemSpecs;
134
b1ab9ed8
A
135/* PrivateKeyUsagePeriod components. */
136typedef struct {
137 DERItem notBefore;
138 DERItem notAfter;
139} DERPrivateKeyUsagePeriod;
140
141/* DERItemSpecs to decode into a DERPrivateKeyUsagePeriod */
142extern const DERItemSpec DERPrivateKeyUsagePeriodItemSpecs[];
143extern const DERSize DERNumPrivateKeyUsagePeriodItemSpecs;
144
145/* DistributionPoint components. */
146typedef struct {
147 DERItem distributionPoint;
148 DERItem reasons;
149 DERItem cRLIssuer;
150} DERDistributionPoint;
151
152/* DERItemSpecs to decode into a DERDistributionPoint */
153extern const DERItemSpec DERDistributionPointItemSpecs[];
154extern const DERSize DERNumDistributionPointItemSpecs;
155
156/* PolicyInformation components. */
157typedef struct {
158 DERItem policyIdentifier;
159 DERItem policyQualifiers;
160} DERPolicyInformation;
161
162/* DERItemSpecs to decode into a DERPolicyInformation */
163extern const DERItemSpec DERPolicyInformationItemSpecs[];
164extern const DERSize DERNumPolicyInformationItemSpecs;
165
166/* PolicyQualifierInfo components. */
167typedef struct {
168 DERItem policyQualifierID;
169 DERItem qualifier;
170} DERPolicyQualifierInfo;
171
172/* DERItemSpecs to decode into a DERPolicyQualifierInfo */
173extern const DERItemSpec DERPolicyQualifierInfoItemSpecs[];
174extern const DERSize DERNumPolicyQualifierInfoItemSpecs;
175
176/* UserNotice components. */
177typedef struct {
178 DERItem noticeRef;
179 DERItem explicitText;
180} DERUserNotice;
181
182/* DERItemSpecs to decode into a DERUserNotice */
183extern const DERItemSpec DERUserNoticeItemSpecs[];
184extern const DERSize DERNumUserNoticeItemSpecs;
185
186/* NoticeReference components. */
187typedef struct {
188 DERItem organization;
189 DERItem noticeNumbers;
190} DERNoticeReference;
191
192/* DERItemSpecs to decode into a DERNoticeReference */
193extern const DERItemSpec DERNoticeReferenceItemSpecs[];
194extern const DERSize DERNumNoticeReferenceItemSpecs;
195
196/* PolicyMapping components. */
197typedef struct {
198 DERItem issuerDomainPolicy;
199 DERItem subjectDomainPolicy;
200} DERPolicyMapping;
201
202/* DERItemSpecs to decode into a DERPolicyMapping */
203extern const DERItemSpec DERPolicyMappingItemSpecs[];
204extern const DERSize DERNumPolicyMappingItemSpecs;
205
206/* AccessDescription components. */
207typedef struct {
208 DERItem accessMethod;
209 DERItem accessLocation;
210} DERAccessDescription;
211
212/* DERItemSpecs to decode into a DERAccessDescription */
213extern const DERItemSpec DERAccessDescriptionItemSpecs[];
214extern const DERSize DERNumAccessDescriptionItemSpecs;
215
216/* AuthorityKeyIdentifier components. */
217typedef struct {
218 DERItem keyIdentifier;
219 DERItem authorityCertIssuer;
220 DERItem authorityCertSerialNumber;
221} DERAuthorityKeyIdentifier;
222
223/* DERItemSpecs to decode into a DERAuthorityKeyIdentifier */
224extern const DERItemSpec DERAuthorityKeyIdentifierItemSpecs[];
225extern const DERSize DERNumAuthorityKeyIdentifierItemSpecs;
226
227/* OtherName components. */
228typedef struct {
229 DERItem typeIdentifier;
230 DERItem value;
231} DEROtherName;
232
233/* DERItemSpecs to decode into a DEROtherName */
234extern const DERItemSpec DEROtherNameItemSpecs[];
235extern const DERSize DERNumOtherNameItemSpecs;
236
237/* PolicyConstraints components. */
238typedef struct {
239 DERItem requireExplicitPolicy;
240 DERItem inhibitPolicyMapping;
241} DERPolicyConstraints;
242
243/* DERItemSpecs to decode into a DERPolicyConstraints */
244extern const DERItemSpec DERPolicyConstraintsItemSpecs[];
245extern const DERSize DERNumPolicyConstraintsItemSpecs;
246
247/* TBS CRL */
248typedef struct {
249 DERItem version; /* integer, optional */
250 DERItem tbsSigAlg; /* sequence, DERAlgorithmId */
251 DERItem issuer; /* sequence, TBD */
252 DERItem thisUpdate; /* ASN_ANY, SAVE_DER */
253 DERItem nextUpdate; /* ASN_ANY, SAVE_DER */
254 DERItem revokedCerts; /* sequence of DERRevokedCert, optional */
255 DERItem extensions; /* sequence, optional, EXPLICIT */
256} DERTBSCrl;
257
258/* DERItemSpecs to decode into a DERTBSCrl */
259extern const DERItemSpec DERTBSCrlItemSpecs[];
260extern const DERSize DERNumTBSCrlItemSpecs;
261
262typedef struct {
263 DERItem serialNum; /* integer */
264 DERItem revocationDate; /* time - ASN_ANY, SAVE_DER */
265 DERItem extensions; /* sequence, optional, EXPLICIT */
266} DERRevokedCert;
267
268/* DERItemSpecs to decode into a DERRevokedCert */
269extern const DERItemSpec DERRevokedCertItemSpecs[];
270extern const DERSize DERNumRevokedCertItemSpecs;
271
fa7225c8 272__END_DECLS
b1ab9ed8
A
273
274#endif /* _DER_CERT_CRL_H_ */
275