]> git.saurik.com Git - apple/security.git/blob - SecurityTests/clxutils/p12/pkcs12Parsed.h
Security-57336.1.9.tar.gz
[apple/security.git] / SecurityTests / clxutils / p12 / pkcs12Parsed.h
1 /*
2 * Copyright (c) 2003-2005 Apple Computer, 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
7 * obtain a copy of the License at http://www.apple.com/publicsource and
8 * read it before 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
12 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
13 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
15 * Please see the License for the specific language governing rights and
16 * limitations under the License.
17 */
18
19 /*
20 * Parsed contents of a p12 blob
21 */
22
23 #ifndef _PKCS12_PARSED_H_
24 #define _PKCS12_PARSED_H_
25
26 #include <Security/cssmtype.h>
27 #include <string.h>
28 #include "SecNssCoder.h"
29
30
31 /*
32 * A collection of CSSM_DATAs which are known to be {Cert, CRL, ...}
33 */
34 class P12KnownBlobs {
35 public:
36 P12KnownBlobs(SecNssCoder &coder);
37 ~P12KnownBlobs() { }
38 void addBlob(const CSSM_DATA &blob);
39
40 CSSM_DATA *mBlobs;
41 unsigned mNumBlobs;
42 SecNssCoder &mCoder;
43 };
44
45 /*
46 * Unknown thingie.
47 */
48 class P12UnknownBlob {
49 public:
50 P12UnknownBlob(const CSSM_DATA &blob, const CSSM_OID &oid);
51 P12UnknownBlob(const CSSM_DATA &blob, const char *descr);
52
53 CSSM_DATA mBlob;
54 CSSM_OID mOid; // optional
55 char mDescr[200]; // optional
56 };
57
58 class P12UnknownBlobs {
59 public:
60 P12UnknownBlobs(SecNssCoder &coder);
61 ~P12UnknownBlobs();
62 void addBlob(P12UnknownBlob *blob);
63
64 P12UnknownBlob **mBlobs;
65 unsigned mNumBlobs;
66 SecNssCoder &mCoder;
67 };
68
69 /*
70 * The stuff we can get by parsing a p12 blob.
71 * Currently highly incomplete. Add to it when we can
72 * parse more.
73 */
74 typedef enum {
75 PE_Cert, // X509 only
76 PE_CRL, // ditto
77 PE_Other // expand here
78 } P12ElementType;
79
80 class P12Parsed {
81 public:
82 P12Parsed(SecNssCoder &coder);
83 ~P12Parsed() { }
84
85 SecNssCoder &mCoder;
86 /* the stuff */
87 P12KnownBlobs mCerts;
88 P12KnownBlobs mCrls;
89 P12UnknownBlobs mUnknown;
90 };
91
92 #endif /* _PKCS12_PARSED_H_ */