Back to index

lightning-sunbird  0.9+nobinonly
crmfit.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 #ifndef _CRMFIT_H_
00040 #define _CRMFIT_H_
00041 
00042 struct CRMFCertReqMessagesStr {
00043     CRMFCertReqMsg **messages;
00044     PRArenaPool     *poolp;
00045 };
00046 
00047 struct CRMFCertExtensionStr {
00048     SECItem id;
00049     SECItem critical;
00050     SECItem value;
00051 };
00052 
00053 
00054 struct CRMFOptionalValidityStr {
00055     SECItem notBefore; 
00056     SECItem notAfter;
00057 };
00058 
00059 struct CRMFCertTemplateStr {
00060     SECItem                   version;
00061     SECItem                   serialNumber;
00062     SECAlgorithmID           *signingAlg;
00063     CERTName                 *issuer;
00064     CRMFOptionalValidity     *validity;
00065     CERTName                 *subject;
00066     CERTSubjectPublicKeyInfo *publicKey;
00067     SECItem                   issuerUID;
00068     SECItem                   subjectUID; 
00069     CRMFCertExtension       **extensions;
00070     int                       numExtensions;
00071 };
00072 
00073 struct CRMFCertIDStr {
00074     SECItem issuer; /* General Name */
00075     SECItem serialNumber; /*INTEGER*/
00076 };
00077 
00078 struct CRMFEncryptedValueStr {
00079     SECAlgorithmID *intendedAlg;
00080     SECAlgorithmID *symmAlg;
00081     SECItem         encSymmKey; /*BIT STRING   */
00082     SECAlgorithmID *keyAlg;
00083     SECItem         valueHint;  /*OCTET STRING */
00084     SECItem         encValue;   /*BIT STRING   */
00085 };
00086 
00087 /*
00088  * The field derValue will contain the actual der
00089  * to include in the encoding or that was read in
00090  * from a der blob. 
00091  */
00092 struct CRMFEncryptedKeyStr {
00093     union {
00094         SEC_PKCS7ContentInfo   *envelopedData;
00095         CRMFEncryptedValue      encryptedValue; 
00096     } value;
00097     CRMFEncryptedKeyChoice encKeyChoice;
00098     SECItem derValue;
00099 };
00100 
00101 /* ASN1 must only have one of the following 3 options. */
00102 struct CRMFPKIArchiveOptionsStr {
00103     union {
00104         CRMFEncryptedKey  encryptedKey;
00105         SECItem           keyGenParameters;
00106         SECItem           archiveRemGenPrivKey; /* BOOLEAN */
00107     } option;
00108     CRMFPKIArchiveOptionsType archOption;
00109 };
00110 
00111 struct CRMFPKIPublicationInfoStr {
00112     SECItem action; /* Possible values                    */
00113                     /* dontPublish (0), pleasePublish (1) */
00114     CRMFSinglePubInfo **pubInfos; 
00115 };
00116 
00117 struct CRMFControlStr {
00118     SECOidTag  tag;
00119     SECItem    derTag;
00120     SECItem    derValue;
00121     /* These will be C structures used to represent the various 
00122      * options.  Values that can't be stored as der right away.
00123      * After creating these structures, we'll place their der
00124      * encoding in derValue so the encoder knows how to get to
00125      * it.
00126      */
00127     union {
00128         CRMFCertID              oldCertId;
00129         CRMFPKIArchiveOptions   archiveOptions;
00130         CRMFPKIPublicationInfo  pubInfo;
00131         CRMFProtocolEncrKey     protEncrKey; 
00132     } value;
00133 };
00134 
00135 struct CRMFCertRequestStr {
00136     SECItem            certReqId;
00137     CRMFCertTemplate   certTemplate;
00138     CRMFControl      **controls;
00139     /* The following members are used by the internal implementation, but
00140      * are not part of the encoding.
00141      */
00142     PRArenaPool *poolp;
00143     PRUint32     requestID; /* This is the value that will be encoded into
00144                           * the certReqId field.
00145                           */
00146 };                                   
00147 
00148 struct CRMFAttributeStr {
00149     SECItem derTag;
00150     SECItem derValue;
00151 };
00152 
00153 struct CRMFCertReqMsgStr {
00154     CRMFCertRequest            *certReq;
00155     CRMFProofOfPossession      *pop;
00156     CRMFAttribute             **regInfo;
00157     SECItem                     derPOP;
00158     /* This arena will be used for allocating memory when decoding.
00159      */
00160     PRArenaPool *poolp;
00161     PRBool       isDecoded;
00162 };
00163 
00164 struct CRMFPOPOSigningKeyInputStr {
00165     /* ASN1 must have only one of the next 2 options */
00166     union {
00167         SECItem          sender; /*General Name*/
00168         CRMFPKMACValue  *publicKeyMAC;
00169     }authInfo;
00170     CERTSubjectPublicKeyInfo publicKey;
00171 };
00172 
00173 struct CRMFPOPOSigningKeyStr {
00174     SECItem                  derInput; /*If in the future we support 
00175                                         *POPOSigningKeyInput, this will
00176                                         *a C structure representation
00177                                         *instead.
00178                                         */
00179     SECAlgorithmID          *algorithmIdentifier;
00180     SECItem                  signature; /* This is a BIT STRING. Remember */
00181 };                                      /* that when interpreting.        */
00182 
00183 /* ASN1 must only choose one of these members */
00184 struct CRMFPOPOPrivKeyStr {
00185     union {
00186         SECItem thisMessage; /* BIT STRING */
00187         SECItem subsequentMessage; /*INTEGER*/ 
00188         SECItem dhMAC; /*BIT STRING*/
00189     } message;
00190     CRMFPOPOPrivKeyChoice messageChoice;
00191 };
00192 
00193 /* ASN1 must only have one of these options. */
00194 struct CRMFProofOfPossessionStr {
00195     union {
00196         SECItem             raVerified;
00197         CRMFPOPOSigningKey  signature;
00198         CRMFPOPOPrivKey     keyEncipherment;
00199         CRMFPOPOPrivKey     keyAgreement;
00200     } popChoice;
00201     CRMFPOPChoice       popUsed; /*Not part of encoding*/
00202 };
00203 
00204 struct CRMFPKMACValueStr {
00205     SECAlgorithmID algID;
00206     SECItem        value; /*BIT STRING*/
00207 };
00208 
00209 struct CRMFSinglePubInfoStr {
00210     SECItem pubMethod; /* Possible Values:
00211                      *   dontCare (0)
00212                      *   x500     (1)
00213                      *   web      (2)
00214                      *   ldap     (3)
00215                      */
00216     CERTGeneralName *pubLocation; /* General Name */
00217 };
00218 
00219 #endif /* _CRMFIT_H_ */