]> git.saurik.com Git - apple/security.git/blob - OSX/libsecurity_apple_x509_cl/lib/DecodedCrl.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / libsecurity_apple_x509_cl / lib / DecodedCrl.h
1 /*
2 * Copyright (c) 2002,2011,2014 Apple 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 * DecodedCrl.h - object representing a decoded cert in NSS form, with
21 * extensions parsed and decoded (still in NSS format).
22 *
23 *
24 * See DecodedItem.h for details on the care and feeding of this
25 * module.
26 */
27
28 #ifndef _DECODED_CRL_H_
29 #define _DECODED_CRL_H_
30
31 #include <Security/cssmtype.h>
32 #include <security_cdsa_utilities/cssmdata.h>
33
34 #include "DecodedItem.h"
35 #include <Security/X509Templates.h>
36
37 class DecodedCrl : /* for now public CertificateList, */ public DecodedItem
38 {
39 NOCOPY(DecodedCrl)
40 public:
41 /* construct empty CRL, no decoded extensions */
42 DecodedCrl(
43 AppleX509CLSession &session);
44
45 /* one-shot constructor, decoding from DER-encoded data */
46 DecodedCrl(
47 AppleX509CLSession &session,
48 const CssmData &encodedCrl);
49
50 ~DecodedCrl();
51
52 /* decode CRLToSign and its extensions */
53 void decodeCts(
54 const CssmData &encodedCTS);
55
56 /* encode TBSCert and its extensions */
57 void encodeExtensions();
58 void encodeCts(
59 CssmOwnedData &encodedTbs);
60
61 /***
62 *** field accessors (in CrlFields.cpp)
63 ***/
64
65 /*
66 * Obtain the index'th occurrence of field specified by fieldId.
67 * Format of the returned field depends on fieldId.
68 * Returns total number of fieldId fields in the cert if index is 0.
69 * Returns true if specified field was found, else returns false.
70 */
71 bool getCrlFieldData(
72 const CssmOid &fieldId, // which field
73 unsigned index, // which occurrence (0 = first)
74 uint32 &numFields, // RETURNED
75 CssmOwnedData &fieldValue); // RETURNED
76
77 /*
78 * Set the field specified by fieldId in TBS.
79 * Note no index - individual field routines either append (for extensions)
80 * or throw if field already set (for all others)
81 */
82 void setCrlField(
83 const CssmOid &fieldId, // which field
84 const CssmData &fieldValue);
85
86 /*
87 * Free the fieldId-specific data referred to by fieldValue.get().data().
88 */
89 static void freeCrlFieldData(
90 const CssmOid &fieldId,
91 CssmOwnedData &fieldValue);
92
93 void getAllParsedCrlFields(
94 uint32 &NumberOfFields, // RETURNED
95 CSSM_FIELD_PTR &CertFields); // RETURNED
96
97 static void describeFormat(
98 Allocator &alloc,
99 uint32 &NumberOfFields,
100 CSSM_OID_PTR &OidList);
101
102 NSS_Crl mCrl;
103
104 };
105
106 #endif /* _DECODED_CRL_H_ */