Import from 1.9a8 tarball
[mozilla-nss.git] / security / nss / lib / crmf / crmft.h
blob5ea0d01aca289f09405d9ff64b5ea26ffb0acb6d
1 /* -*- Mode: C; tab-width: 8 -*-*/
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is the Netscape security libraries.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1994-2000
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either the GNU General Public License Version 2 or later (the "GPL"), or
26 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
39 /* Header file with all of the structures and types that will be exported
40 * by the security library for implementation of CRMF.
43 #ifndef _CRMFT_H_
44 #define _CRMFT_H_
46 /* Use these enumerated values for adding fields to the certificate request */
47 typedef enum {
48 crmfVersion = 0,
49 crmfSerialNumber = 1,
50 crmfSigningAlg = 2,
51 crmfIssuer = 3,
52 crmfValidity = 4,
53 crmfSubject = 5,
54 crmfPublicKey = 6,
55 crmfIssuerUID = 7,
56 crmfSubjectUID = 8,
57 crmfExtension = 9
58 } CRMFCertTemplateField;
61 * An enumeration for the different types of controls.
63 typedef enum {
64 crmfNoControl = 0,
65 crmfRegTokenControl = 1,
66 crmfAuthenticatorControl = 2,
67 crmfPKIPublicationInfoControl = 3,
68 crmfPKIArchiveOptionsControl = 4,
69 crmfOldCertIDControl = 5,
70 crmfProtocolEncrKeyControl = 6
71 } CRMFControlType;
74 * The possible values that are passed into CRMF_CreatePKIPublicationInfo
76 typedef enum {
77 crmfDontPublish = 0,
78 crmfPleasePublish = 1
79 } CRMFPublicationAction;
82 * An enumeration for the possible for pubMethod which is a part of
83 * the SinglePubInfo ASN1 type.
85 typedef enum {
86 crmfDontCare = 0,
87 crmfX500 = 1,
88 crmfWeb = 2,
89 crmfLdap = 3
90 } CRMFPublicationMethod;
93 * An enumeration for the different options for PKIArchiveOptions type.
95 typedef enum {
96 crmfNoArchiveOptions = 0,
97 crmfEncryptedPrivateKey = 1,
98 crmfKeyGenParameters = 2,
99 crmfArchiveRemGenPrivKey = 3
100 } CRMFPKIArchiveOptionsType;
103 * An enumeration for the different options for ProofOfPossession
105 typedef enum {
106 crmfNoPOPChoice = 0,
107 crmfRAVerified = 1,
108 crmfSignature = 2,
109 crmfKeyEncipherment = 3,
110 crmfKeyAgreement = 4
111 } CRMFPOPChoice;
114 * An enumertion type for options for the authInfo field of the
115 * CRMFPOPOSigningKeyInput structure.
117 typedef enum {
118 crmfSender = 0,
119 crmfPublicKeyMAC = 1
120 } CRMFPOPOSkiInputAuthChoice;
123 * An enumeration for the SubsequentMessage Options.
125 typedef enum {
126 crmfNoSubseqMess = 0,
127 crmfEncrCert = 1,
128 crmfChallengeResp = 2
129 } CRMFSubseqMessOptions;
132 * An enumeration for the choice used by POPOPrivKey.
134 typedef enum {
135 crmfNoMessage = 0,
136 crmfThisMessage = 1,
137 crmfSubsequentMessage = 2,
138 crmfDHMAC = 3
139 } CRMFPOPOPrivKeyChoice;
142 * An enumeration for the choices for the EncryptedKey type.
144 typedef enum {
145 crmfNoEncryptedKeyChoice = 0,
146 crmfEncryptedValueChoice = 1,
147 crmfEnvelopedDataChoice = 2
148 } CRMFEncryptedKeyChoice;
151 * TYPE: CRMFEncoderOutputCallback
152 * This function type defines a prototype for a function that the CRMF
153 * library expects when encoding is performed.
155 * ARGUMENTS:
156 * arg
157 * This will be a pointer the user passed into an encoding function.
158 * The user of the library is free to use this pointer in any way.
159 * The most common use is to keep around a buffer for writing out
160 * the DER encoded bytes.
161 * buf
162 * The DER encoded bytes that should be written out.
163 * len
164 * The number of DER encoded bytes to write out.
167 typedef void (*CRMFEncoderOutputCallback) (void *arg,
168 const char *buf,
169 unsigned long len);
172 * Type for the function that gets a password. Just in case we ever
173 * need to support publicKeyMAC for POPOSigningKeyInput
175 typedef SECItem* (*CRMFMACPasswordCallback) (void *arg);
177 typedef struct CRMFOptionalValidityStr CRMFOptionalValidity;
178 typedef struct CRMFValidityCreationInfoStr CRMFGetValidity;
179 typedef struct CRMFCertTemplateStr CRMFCertTemplate;
180 typedef struct CRMFCertRequestStr CRMFCertRequest;
181 typedef struct CRMFCertReqMsgStr CRMFCertReqMsg;
182 typedef struct CRMFCertReqMessagesStr CRMFCertReqMessages;
183 typedef struct CRMFProofOfPossessionStr CRMFProofOfPossession;
184 typedef struct CRMFPOPOSigningKeyStr CRMFPOPOSigningKey;
185 typedef struct CRMFPOPOSigningKeyInputStr CRMFPOPOSigningKeyInput;
186 typedef struct CRMFPOPOPrivKeyStr CRMFPOPOPrivKey;
187 typedef struct CRMFPKIPublicationInfoStr CRMFPKIPublicationInfo;
188 typedef struct CRMFSinglePubInfoStr CRMFSinglePubInfo;
189 typedef struct CRMFPKIArchiveOptionsStr CRMFPKIArchiveOptions;
190 typedef struct CRMFEncryptedKeyStr CRMFEncryptedKey;
191 typedef struct CRMFEncryptedValueStr CRMFEncryptedValue;
192 typedef struct CRMFCertIDStr CRMFCertID;
193 typedef struct CRMFCertIDStr CRMFOldCertID;
194 typedef CERTSubjectPublicKeyInfo CRMFProtocolEncrKey;
195 typedef struct CRMFValidityCreationInfoStr CRMFValidityCreationInfo;
196 typedef struct CRMFCertExtCreationInfoStr CRMFCertExtCreationInfo;
197 typedef struct CRMFPKMACValueStr CRMFPKMACValue;
198 typedef struct CRMFAttributeStr CRMFAttribute;
199 typedef struct CRMFControlStr CRMFControl;
200 typedef CERTGeneralName CRMFGeneralName;
201 typedef struct CRMFCertExtensionStr CRMFCertExtension;
203 struct CRMFValidityCreationInfoStr {
204 PRTime *notBefore;
205 PRTime *notAfter;
208 struct CRMFCertExtCreationInfoStr {
209 CRMFCertExtension **extensions;
210 int numExtensions;
214 * Some ASN1 Templates that may be needed.
216 extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[];
217 extern const SEC_ASN1Template CRMFCertRequestTemplate[];
220 #endif /*_CRMFT_H_*/