PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/gecko_api/include/crmft.h

http://firefox-mac-pdf.googlecode.com/
C++ Header | 220 lines | 106 code | 21 blank | 93 comment | 0 complexity | bcdada24135a430e88bac3536cfc1b69 MD5 | raw file
  1/* -*- Mode: C; tab-width: 8 -*-*/
  2/* ***** BEGIN LICENSE BLOCK *****
  3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4 *
  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/
  9 *
 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.
 14 *
 15 * The Original Code is the Netscape security libraries.
 16 *
 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.
 21 *
 22 * Contributor(s):
 23 *
 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.
 35 *
 36 * ***** END LICENSE BLOCK ***** */
 37
 38
 39/* Header file with all of the structures and types that will be exported 
 40 * by the security library for implementation of CRMF.
 41 */
 42
 43#ifndef _CRMFT_H_
 44#define _CRMFT_H_
 45
 46/* Use these enumerated values for adding fields to the certificate request */
 47typedef 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;
 59
 60/*
 61 * An enumeration for the different types of controls.
 62 */
 63typedef enum {
 64    crmfNoControl = 0,
 65    crmfRegTokenControl = 1,
 66    crmfAuthenticatorControl = 2,
 67    crmfPKIPublicationInfoControl = 3,
 68    crmfPKIArchiveOptionsControl = 4,
 69    crmfOldCertIDControl = 5,
 70    crmfProtocolEncrKeyControl = 6
 71} CRMFControlType;
 72
 73/*
 74 * The possible values that are passed into CRMF_CreatePKIPublicationInfo
 75 */
 76typedef enum {
 77    crmfDontPublish = 0,
 78    crmfPleasePublish = 1
 79} CRMFPublicationAction;
 80
 81/*
 82 * An enumeration for the possible for pubMethod which is a part of 
 83 * the SinglePubInfo ASN1 type.
 84 */
 85typedef enum {
 86    crmfDontCare = 0,
 87    crmfX500 = 1,
 88    crmfWeb = 2,
 89    crmfLdap = 3
 90} CRMFPublicationMethod;
 91
 92/*
 93 * An enumeration for the different options for PKIArchiveOptions type.
 94 */
 95typedef enum {
 96    crmfNoArchiveOptions = 0,
 97    crmfEncryptedPrivateKey = 1,
 98    crmfKeyGenParameters = 2,
 99    crmfArchiveRemGenPrivKey = 3
100} CRMFPKIArchiveOptionsType;
101
102/*
103 * An enumeration for the different options for ProofOfPossession
104 */
105typedef enum {
106    crmfNoPOPChoice = 0,
107    crmfRAVerified = 1,
108    crmfSignature = 2,
109    crmfKeyEncipherment = 3,
110    crmfKeyAgreement = 4
111} CRMFPOPChoice;
112
113/*
114 * An enumertion type for options for the authInfo field of the 
115 * CRMFPOPOSigningKeyInput structure.
116 */
117typedef enum {
118    crmfSender = 0,
119    crmfPublicKeyMAC = 1
120} CRMFPOPOSkiInputAuthChoice;
121
122/*
123 * An enumeration for the SubsequentMessage Options.
124 */
125typedef enum {
126    crmfNoSubseqMess = 0,
127    crmfEncrCert = 1,
128    crmfChallengeResp = 2
129} CRMFSubseqMessOptions;
130
131/*
132 * An enumeration for the choice used by POPOPrivKey.
133 */
134typedef enum {
135    crmfNoMessage = 0,
136    crmfThisMessage = 1,
137    crmfSubsequentMessage = 2,
138    crmfDHMAC = 3
139} CRMFPOPOPrivKeyChoice;
140
141/*
142 * An enumeration for the choices for the EncryptedKey type.
143 */
144typedef enum {
145    crmfNoEncryptedKeyChoice = 0,
146    crmfEncryptedValueChoice = 1,
147    crmfEnvelopedDataChoice = 2
148} CRMFEncryptedKeyChoice;
149
150/*
151 * TYPE: CRMFEncoderOutputCallback
152 *     This function type defines a prototype for a function that the CRMF
153 *     library expects when encoding is performed.
154 *
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.
165 *
166 */
167typedef void (*CRMFEncoderOutputCallback) (void *arg,
168					   const char *buf,
169					   unsigned long len);
170
171/*
172 * Type for the function that gets a password.  Just in case we ever
173 * need to support publicKeyMAC for POPOSigningKeyInput
174 */
175typedef SECItem* (*CRMFMACPasswordCallback) (void *arg);
176
177typedef struct CRMFOptionalValidityStr      CRMFOptionalValidity;
178typedef struct CRMFValidityCreationInfoStr  CRMFGetValidity;
179typedef struct CRMFCertTemplateStr          CRMFCertTemplate;
180typedef struct CRMFCertRequestStr           CRMFCertRequest;
181typedef struct CRMFCertReqMsgStr            CRMFCertReqMsg;
182typedef struct CRMFCertReqMessagesStr       CRMFCertReqMessages;
183typedef struct CRMFProofOfPossessionStr     CRMFProofOfPossession;
184typedef struct CRMFPOPOSigningKeyStr        CRMFPOPOSigningKey;
185typedef struct CRMFPOPOSigningKeyInputStr   CRMFPOPOSigningKeyInput;
186typedef struct CRMFPOPOPrivKeyStr           CRMFPOPOPrivKey;
187typedef struct CRMFPKIPublicationInfoStr    CRMFPKIPublicationInfo;
188typedef struct CRMFSinglePubInfoStr         CRMFSinglePubInfo;
189typedef struct CRMFPKIArchiveOptionsStr     CRMFPKIArchiveOptions;
190typedef struct CRMFEncryptedKeyStr          CRMFEncryptedKey;
191typedef struct CRMFEncryptedValueStr        CRMFEncryptedValue;
192typedef struct CRMFCertIDStr                CRMFCertID;
193typedef struct CRMFCertIDStr                CRMFOldCertID;
194typedef CERTSubjectPublicKeyInfo            CRMFProtocolEncrKey;
195typedef struct CRMFValidityCreationInfoStr  CRMFValidityCreationInfo;
196typedef struct CRMFCertExtCreationInfoStr   CRMFCertExtCreationInfo;
197typedef struct CRMFPKMACValueStr            CRMFPKMACValue;
198typedef struct CRMFAttributeStr             CRMFAttribute;
199typedef struct CRMFControlStr               CRMFControl;
200typedef CERTGeneralName                     CRMFGeneralName;
201typedef struct CRMFCertExtensionStr         CRMFCertExtension;
202
203struct CRMFValidityCreationInfoStr {
204    PRTime *notBefore;
205    PRTime *notAfter;
206};
207
208struct CRMFCertExtCreationInfoStr {
209    CRMFCertExtension **extensions;
210    int numExtensions;
211};
212
213/*
214 * Some ASN1 Templates that may be needed.
215 */
216extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[];
217extern const SEC_ASN1Template CRMFCertRequestTemplate[];
218
219
220#endif /*_CRMFT_H_*/