Back to index

lightning-sunbird  0.9+nobinonly
cmmfi.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  * These are the definitions needed by the library internally to implement
00040  * CMMF.  Most of these will be helper utilities for manipulating internal
00041  * data strucures.
00042  */
00043 #ifndef _CMMFI_H_
00044 #define _CMMFI_H_
00045 #include "cmmfit.h"
00046 #include "crmfi.h"
00047 
00048 #define CMMF_MAX_CHALLENGES 10
00049 #define CMMF_MAX_KEY_PAIRS  50
00050 
00051 /*
00052  * Some templates that the code will need to implement CMMF.
00053  */
00054 extern const SEC_ASN1Template CMMFCertOrEncCertCertificateTemplate[];
00055 extern const SEC_ASN1Template CMMFCertOrEncCertEncryptedCertTemplate[];
00056 extern const SEC_ASN1Template CMMFPOPODecKeyRespContentTemplate[];
00057 extern const SEC_ASN1Template CMMFRandTemplate[];
00058 extern const SEC_ASN1Template CMMFSequenceOfCertsTemplate[];
00059 extern const SEC_ASN1Template CMMFPKIStatusInfoTemplate[];
00060 extern const SEC_ASN1Template CMMFCertifiedKeyPairTemplate[];
00061 
00062 
00063 /*
00064  * Some utility functions that are shared by multiple files in this 
00065  * implementation.
00066  */
00067 
00068 extern SECStatus cmmf_CopyCertResponse (PRArenaPool      *poolp, 
00069                                    CMMFCertResponse *dest, 
00070                                    CMMFCertResponse *src);
00071 
00072 extern SECStatus cmmf_CopyPKIStatusInfo (PRArenaPool       *poolp, 
00073                                     CMMFPKIStatusInfo *dest,
00074                                     CMMFPKIStatusInfo *src);
00075 
00076 extern SECStatus cmmf_CopyCertifiedKeyPair(PRArenaPool          *poolp, 
00077                                       CMMFCertifiedKeyPair *dest,
00078                                       CMMFCertifiedKeyPair *src);
00079 
00080 extern SECStatus cmmf_DestroyPKIStatusInfo(CMMFPKIStatusInfo *info, 
00081                                       PRBool freeit);
00082 
00083 extern SECStatus cmmf_DestroyCertOrEncCert(CMMFCertOrEncCert *certOrEncCert, 
00084                                       PRBool freeit);
00085 
00086 extern SECStatus cmmf_PKIStatusInfoSetStatus(CMMFPKIStatusInfo    *statusInfo,
00087                                         PRArenaPool          *poolp,
00088                                         CMMFPKIStatus         inStatus);
00089 
00090 extern SECStatus cmmf_ExtractCertsFromList(CERTCertList      *inCertList,
00091                                       PRArenaPool       *poolp,
00092                                       CERTCertificate ***certArray);
00093 
00094 extern SECStatus 
00095        cmmf_CertOrEncCertSetCertificate(CMMFCertOrEncCert *certOrEncCert,
00096                                    PRArenaPool       *poolp,
00097                                    CERTCertificate   *inCert);
00098 
00099 extern CMMFPKIStatus 
00100        cmmf_PKIStatusInfoGetStatus(CMMFPKIStatusInfo *inStatus);
00101 
00102 extern CERTCertList*
00103        cmmf_MakeCertList(CERTCertificate **inCerts);
00104 
00105 extern CERTCertificate*
00106 cmmf_CertOrEncCertGetCertificate(CMMFCertOrEncCert *certOrEncCert,
00107                                  CERTCertDBHandle  *certdb);
00108 
00109 extern SECStatus
00110 cmmf_decode_process_cert_response(PRArenaPool      *poolp, 
00111                               CERTCertDBHandle *db,
00112                               CMMFCertResponse *inCertResp);
00113 
00114 extern SECStatus
00115 cmmf_decode_process_certified_key_pair(PRArenaPool          *poolp,
00116                                    CERTCertDBHandle     *db,
00117                                    CMMFCertifiedKeyPair *inCertKeyPair);
00118 
00119 extern SECStatus
00120 cmmf_user_encode(void *src, CRMFEncoderOutputCallback inCallback, void *inArg,
00121                const SEC_ASN1Template *inTemplate);
00122 
00123 extern SECStatus
00124 cmmf_copy_secitem (PRArenaPool *poolp, SECItem *dest, SECItem *src);
00125 #endif /*_CMMFI_H_*/
00126 
00127 
00128 
00129 
00130