Back to index

lightning-sunbird  0.9+nobinonly
crmft.h
Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 8 -*-*/
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Netscape security libraries.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 
00039 /* Header file with all of the structures and types that will be exported 
00040  * by the security library for implementation of CRMF.
00041  */
00042 
00043 #ifndef _CRMFT_H_
00044 #define _CRMFT_H_
00045 
00046 /* Use these enumerated values for adding fields to the certificate request */
00047 typedef enum {
00048     crmfVersion = 0,
00049     crmfSerialNumber = 1,
00050     crmfSigningAlg = 2,
00051     crmfIssuer = 3,
00052     crmfValidity = 4,
00053     crmfSubject = 5,
00054     crmfPublicKey = 6,
00055     crmfIssuerUID = 7,
00056     crmfSubjectUID = 8,
00057     crmfExtension = 9
00058 } CRMFCertTemplateField;
00059 
00060 /*
00061  * An enumeration for the different types of controls.
00062  */
00063 typedef enum {
00064     crmfNoControl = 0,
00065     crmfRegTokenControl = 1,
00066     crmfAuthenticatorControl = 2,
00067     crmfPKIPublicationInfoControl = 3,
00068     crmfPKIArchiveOptionsControl = 4,
00069     crmfOldCertIDControl = 5,
00070     crmfProtocolEncrKeyControl = 6
00071 } CRMFControlType;
00072 
00073 /*
00074  * The possible values that are passed into CRMF_CreatePKIPublicationInfo
00075  */
00076 typedef enum {
00077     crmfDontPublish = 0,
00078     crmfPleasePublish = 1
00079 } CRMFPublicationAction;
00080 
00081 /*
00082  * An enumeration for the possible for pubMethod which is a part of 
00083  * the SinglePubInfo ASN1 type.
00084  */
00085 typedef enum {
00086     crmfDontCare = 0,
00087     crmfX500 = 1,
00088     crmfWeb = 2,
00089     crmfLdap = 3
00090 } CRMFPublicationMethod;
00091 
00092 /*
00093  * An enumeration for the different options for PKIArchiveOptions type.
00094  */
00095 typedef enum {
00096     crmfNoArchiveOptions = 0,
00097     crmfEncryptedPrivateKey = 1,
00098     crmfKeyGenParameters = 2,
00099     crmfArchiveRemGenPrivKey = 3
00100 } CRMFPKIArchiveOptionsType;
00101 
00102 /*
00103  * An enumeration for the different options for ProofOfPossession
00104  */
00105 typedef enum {
00106     crmfNoPOPChoice = 0,
00107     crmfRAVerified = 1,
00108     crmfSignature = 2,
00109     crmfKeyEncipherment = 3,
00110     crmfKeyAgreement = 4
00111 } CRMFPOPChoice;
00112 
00113 /*
00114  * An enumertion type for options for the authInfo field of the 
00115  * CRMFPOPOSigningKeyInput structure.
00116  */
00117 typedef enum {
00118     crmfSender = 0,
00119     crmfPublicKeyMAC = 1
00120 } CRMFPOPOSkiInputAuthChoice;
00121 
00122 /*
00123  * An enumeration for the SubsequentMessage Options.
00124  */
00125 typedef enum {
00126     crmfNoSubseqMess = 0,
00127     crmfEncrCert = 1,
00128     crmfChallengeResp = 2
00129 } CRMFSubseqMessOptions;
00130 
00131 /*
00132  * An enumeration for the choice used by POPOPrivKey.
00133  */
00134 typedef enum {
00135     crmfNoMessage = 0,
00136     crmfThisMessage = 1,
00137     crmfSubsequentMessage = 2,
00138     crmfDHMAC = 3
00139 } CRMFPOPOPrivKeyChoice;
00140 
00141 /*
00142  * An enumeration for the choices for the EncryptedKey type.
00143  */
00144 typedef enum {
00145     crmfNoEncryptedKeyChoice = 0,
00146     crmfEncryptedValueChoice = 1,
00147     crmfEnvelopedDataChoice = 2
00148 } CRMFEncryptedKeyChoice;
00149 
00150 /*
00151  * TYPE: CRMFEncoderOutputCallback
00152  *     This function type defines a prototype for a function that the CRMF
00153  *     library expects when encoding is performed.
00154  *
00155  * ARGUMENTS:
00156  *     arg
00157  *         This will be a pointer the user passed into an encoding function.
00158  *         The user of the library is free to use this pointer in any way.
00159  *         The most common use is to keep around a buffer for writing out
00160  *         the DER encoded bytes.
00161  *     buf
00162  *         The DER encoded bytes that should be written out.
00163  *     len
00164  *         The number of DER encoded bytes to write out.
00165  *
00166  */
00167 typedef void (*CRMFEncoderOutputCallback) (void *arg,
00168                                       const char *buf,
00169                                       unsigned long len);
00170 
00171 /*
00172  * Type for the function that gets a password.  Just in case we ever
00173  * need to support publicKeyMAC for POPOSigningKeyInput
00174  */
00175 typedef SECItem* (*CRMFMACPasswordCallback) (void *arg);
00176 
00177 typedef struct CRMFOptionalValidityStr      CRMFOptionalValidity;
00178 typedef struct CRMFValidityCreationInfoStr  CRMFGetValidity;
00179 typedef struct CRMFCertTemplateStr          CRMFCertTemplate;
00180 typedef struct CRMFCertRequestStr           CRMFCertRequest;
00181 typedef struct CRMFCertReqMsgStr            CRMFCertReqMsg;
00182 typedef struct CRMFCertReqMessagesStr       CRMFCertReqMessages;
00183 typedef struct CRMFProofOfPossessionStr     CRMFProofOfPossession;
00184 typedef struct CRMFPOPOSigningKeyStr        CRMFPOPOSigningKey;
00185 typedef struct CRMFPOPOSigningKeyInputStr   CRMFPOPOSigningKeyInput;
00186 typedef struct CRMFPOPOPrivKeyStr           CRMFPOPOPrivKey;
00187 typedef struct CRMFPKIPublicationInfoStr    CRMFPKIPublicationInfo;
00188 typedef struct CRMFSinglePubInfoStr         CRMFSinglePubInfo;
00189 typedef struct CRMFPKIArchiveOptionsStr     CRMFPKIArchiveOptions;
00190 typedef struct CRMFEncryptedKeyStr          CRMFEncryptedKey;
00191 typedef struct CRMFEncryptedValueStr        CRMFEncryptedValue;
00192 typedef struct CRMFCertIDStr                CRMFCertID;
00193 typedef struct CRMFCertIDStr                CRMFOldCertID;
00194 typedef CERTSubjectPublicKeyInfo            CRMFProtocolEncrKey;
00195 typedef struct CRMFValidityCreationInfoStr  CRMFValidityCreationInfo;
00196 typedef struct CRMFCertExtCreationInfoStr   CRMFCertExtCreationInfo;
00197 typedef struct CRMFPKMACValueStr            CRMFPKMACValue;
00198 typedef struct CRMFAttributeStr             CRMFAttribute;
00199 typedef struct CRMFControlStr               CRMFControl;
00200 typedef CERTGeneralName                     CRMFGeneralName;
00201 typedef struct CRMFCertExtensionStr         CRMFCertExtension;
00202 
00203 struct CRMFValidityCreationInfoStr {
00204     PRTime *notBefore;
00205     PRTime *notAfter;
00206 };
00207 
00208 struct CRMFCertExtCreationInfoStr {
00209     CRMFCertExtension **extensions;
00210     int numExtensions;
00211 };
00212 
00213 /*
00214  * Some ASN1 Templates that may be needed.
00215  */
00216 extern const SEC_ASN1Template CRMFCertReqMessagesTemplate[];
00217 extern const SEC_ASN1Template CRMFCertRequestTemplate[];
00218 
00219 
00220 #endif /*_CRMFT_H_*/