]> git.saurik.com Git - apple/security.git/blob - AppleX509CL/CertBuilder.h
Security-54.1.3.tar.gz
[apple/security.git] / AppleX509CL / CertBuilder.h
1 /*
2 * Copyright (c) 2000-2001 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 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 * CertBuilder.h - sublasses of various snacc-generated cert-related
21 * classes.
22 *
23 * Created 9/1/2000 by Doug Mitchell.
24 * Copyright (c) 2000 by Apple Computer.
25 */
26
27 #ifndef _CERT_BUILDER_H_
28 #define _CERT_BUILDER_H_
29
30 #include <Security/asn-incl.h>
31 #include <Security/sm_vdatypes.h>
32 #include <Security/sm_x501if.h>
33 #include <Security/sm_x520sa.h>
34 #include <Security/sm_x411mtsas.h>
35 #include <Security/sm_x509cmn.h>
36 #include <Security/sm_x509af.h>
37 #include <Security/pkcs9oids.h>
38 #include <Security/sm_x509ce.h>
39 #include <Security/sm_cms.h>
40 #include <Security/sm_ess.h>
41
42 #include <Security/cssmtype.h>
43
44 /*
45 * Name is a complex structure which boils down to an arbitrarily
46 * large array of (usually) printable names. We facilitate the
47 * construction of the array, one AttributeTypeAndDistinguishedValue
48 * per RelativeDistinguishedName. This is the format commonly used
49 * in the real world, though it's legal to have multiple ATDVs
50 * per RDN - we just don't do it here.
51 *
52 * Typically the object manipulated here is inserted into a
53 * CertificateToSign object, as issuer or subject.
54 */
55 class NameBuilder : public Name // Name from sm_x501if
56 {
57 public:
58 void addATDV(
59 const AsnOid &type, // id_at_commonName, etc.
60 // from sm_x520sa
61 const char *value, // the bytes
62 size_t valueLen,
63 DirectoryString::ChoiceIdEnum stringType, // printableStringCid, etc.
64 // from sm_x520sa
65 bool primaryDistinguished = true);
66
67 void addX509Name (
68 const CSSM_X509_NAME *x509Name);
69 };
70
71
72 /*
73 * Custom AsnOid, used for converting CssmOid to AsnOid. The Snacc class
74 * declaration doesn't provide a means to construct from, or set by,
75 * pre-encoded OID bytes (which are available in a CssmOid).
76 */
77 class OidBuilder : public AsnOid
78 {
79 public:
80 OidBuilder(const CSSM_OID &coid);
81 ~OidBuilder() { }
82 };
83
84 #endif /* _CERT_BUILDER_H_ */
85