security/nss/lib/crmf/crmft.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:37c8e9440c28
1 /* -*- Mode: C; tab-width: 8 -*-*/
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /* Header file with all of the structures and types that will be exported
8 * by the security library for implementation of CRMF.
9 */
10
11 #ifndef _CRMFT_H_
12 #define _CRMFT_H_
13
14 /* Use these enumerated values for adding fields to the certificate request */
15 typedef enum {
16 crmfVersion = 0,
17 crmfSerialNumber = 1,
18 crmfSigningAlg = 2,
19 crmfIssuer = 3,
20 crmfValidity = 4,
21 crmfSubject = 5,
22 crmfPublicKey = 6,
23 crmfIssuerUID = 7,
24 crmfSubjectUID = 8,
25 crmfExtension = 9
26 } CRMFCertTemplateField;
27
28 /*
29 * An enumeration for the different types of controls.
30 */
31 typedef enum {
32 crmfNoControl = 0,
33 crmfRegTokenControl = 1,
34 crmfAuthenticatorControl = 2,
35 crmfPKIPublicationInfoControl = 3,
36 crmfPKIArchiveOptionsControl = 4,
37 crmfOldCertIDControl = 5,
38 crmfProtocolEncrKeyControl = 6
39 } CRMFControlType;
40
41 /*
42 * The possible values that are passed into CRMF_CreatePKIPublicationInfo
43 */
44 typedef enum {
45 crmfDontPublish = 0,
46 crmfPleasePublish = 1
47 } CRMFPublicationAction;
48
49 /*
50 * An enumeration for the possible for pubMethod which is a part of
51 * the SinglePubInfo ASN1 type.
52 */
53 typedef enum {
54 crmfDontCare = 0,
55 crmfX500 = 1,
56 crmfWeb = 2,
57 crmfLdap = 3
58 } CRMFPublicationMethod;
59
60 /*
61 * An enumeration for the different options for PKIArchiveOptions type.
62 */
63 typedef enum {
64 crmfNoArchiveOptions = 0,
65 crmfEncryptedPrivateKey = 1,
66 crmfKeyGenParameters = 2,
67 crmfArchiveRemGenPrivKey = 3
68 } CRMFPKIArchiveOptionsType;
69
70 /*
71 * An enumeration for the different options for ProofOfPossession
72 */
73 typedef enum {
74 crmfNoPOPChoice = 0,
75 crmfRAVerified = 1,
76 crmfSignature = 2,
77 crmfKeyEncipherment = 3,
78 crmfKeyAgreement = 4
79 } CRMFPOPChoice;
80
81 /*
82 * An enumertion type for options for the authInfo field of the
83 * CRMFPOPOSigningKeyInput structure.
84 */
85 typedef enum {
86 crmfSender = 0,
87 crmfPublicKeyMAC = 1
88 } CRMFPOPOSkiInputAuthChoice;
89
90 /*
91 * An enumeration for the SubsequentMessage Options.
92 */
93 typedef enum {
94 crmfNoSubseqMess = 0,
95 crmfEncrCert = 1,
96 crmfChallengeResp = 2
97 } CRMFSubseqMessOptions;
98
99 /*
100 * An enumeration for the choice used by POPOPrivKey.
101 */
102 typedef enum {
103 crmfNoMessage = 0,
104 crmfThisMessage = 1,
105 crmfSubsequentMessage = 2,
106 crmfDHMAC = 3
107 } CRMFPOPOPrivKeyChoice;
108
109 /*
110 * An enumeration for the choices for the EncryptedKey type.
111 */
112 typedef enum {
113 crmfNoEncryptedKeyChoice = 0,
114 crmfEncryptedValueChoice = 1,
115 crmfEnvelopedDataChoice = 2
116 } CRMFEncryptedKeyChoice;
117
118 /*
119 * TYPE: CRMFEncoderOutputCallback
120 * This function type defines a prototype for a function that the CRMF
121 * library expects when encoding is performed.
122 *
123 * ARGUMENTS:
124 * arg
125 * This will be a pointer the user passed into an encoding function.
126 * The user of the library is free to use this pointer in any way.
127 * The most common use is to keep around a buffer for writing out
128 * the DER encoded bytes.
129 * buf
130 * The DER encoded bytes that should be written out.
131 * len
132 * The number of DER encoded bytes to write out.
133 *
134 */
135 typedef void (*CRMFEncoderOutputCallback) (void *arg,
136 const char *buf,
137 unsigned long len);
138
139 /*
140 * Type for the function that gets a password. Just in case we ever
141 * need to support publicKeyMAC for POPOSigningKeyInput
142 */
143 typedef SECItem* (*CRMFMACPasswordCallback) (void *arg);
144
145 typedef struct CRMFOptionalValidityStr CRMFOptionalValidity;
146 typedef struct CRMFValidityCreationInfoStr CRMFGetValidity;
147 typedef struct CRMFCertTemplateStr CRMFCertTemplate;
148 typedef struct CRMFCertRequestStr CRMFCertRequest;
149 typedef struct CRMFCertReqMsgStr CRMFCertReqMsg;
150 typedef struct CRMFCertReqMessagesStr CRMFCertReqMessages;
151 typedef struct CRMFProofOfPossessionStr CRMFProofOfPossession;
152 typedef struct CRMFPOPOSigningKeyStr CRMFPOPOSigningKey;
153 typedef struct CRMFPOPOSigningKeyInputStr CRMFPOPOSigningKeyInput;
154 typedef struct CRMFPOPOPrivKeyStr CRMFPOPOPrivKey;
155 typedef struct CRMFPKIPublicationInfoStr CRMFPKIPublicationInfo;
156 typedef struct CRMFSinglePubInfoStr CRMFSinglePubInfo;
157 typedef struct CRMFPKIArchiveOptionsStr CRMFPKIArchiveOptions;
158 typedef struct CRMFEncryptedKeyStr CRMFEncryptedKey;
159 typedef struct CRMFEncryptedValueStr CRMFEncryptedValue;
160 typedef struct CRMFCertIDStr CRMFCertID;
161 typedef struct CRMFCertIDStr CRMFOldCertID;
162 typedef CERTSubjectPublicKeyInfo CRMFProtocolEncrKey;
163 typedef struct CRMFValidityCreationInfoStr CRMFValidityCreationInfo;
164 typedef struct CRMFCertExtCreationInfoStr CRMFCertExtCreationInfo;
165 typedef struct CRMFPKMACValueStr CRMFPKMACValue;
166 typedef struct CRMFAttributeStr CRMFAttribute;
167 typedef struct CRMFControlStr CRMFControl;
168 typedef CERTGeneralName CRMFGeneralName;
169 typedef struct CRMFCertExtensionStr CRMFCertExtension;
170
171 struct CRMFValidityCreationInfoStr {
172 PRTime *notBefore;
173 PRTime *notAfter;
174 };
175
176 struct CRMFCertExtCreationInfoStr {
177 CRMFCertExtension **extensions;
178 int numExtensions;
179 };
180
181 /*
182 * Some ASN1 Templates that may be needed.
183 */
184 extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[];
185 extern const SEC_ASN1Template CRMFCertRequestTemplate[];
186
187
188 #endif /*_CRMFT_H_*/

mercurial