cmmfi.h (3591B)
1 /* -*- Mode: C; tab-width: 8 -*-*/ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* 7 * These are the definitions needed by the library internally to implement 8 * CMMF. Most of these will be helper utilities for manipulating internal 9 * data strucures. 10 */ 11 #ifndef _CMMFI_H_ 12 #define _CMMFI_H_ 13 #include "cmmfit.h" 14 #include "crmfi.h" 15 16 #define CMMF_MAX_CHALLENGES 10 17 #define CMMF_MAX_KEY_PAIRS 50 18 19 /* 20 * Some templates that the code will need to implement CMMF. 21 */ 22 extern const SEC_ASN1Template CMMFCertOrEncCertCertificateTemplate[]; 23 extern const SEC_ASN1Template CMMFCertOrEncCertEncryptedCertTemplate[]; 24 extern const SEC_ASN1Template CMMFPOPODecKeyRespContentTemplate[]; 25 extern const SEC_ASN1Template CMMFRandTemplate[]; 26 extern const SEC_ASN1Template CMMFSequenceOfCertsTemplate[]; 27 extern const SEC_ASN1Template CMMFPKIStatusInfoTemplate[]; 28 extern const SEC_ASN1Template CMMFCertifiedKeyPairTemplate[]; 29 30 /* 31 * Some utility functions that are shared by multiple files in this 32 * implementation. 33 */ 34 35 extern SECStatus cmmf_CopyCertResponse(PLArenaPool *poolp, 36 CMMFCertResponse *dest, 37 CMMFCertResponse *src); 38 39 extern SECStatus cmmf_CopyPKIStatusInfo(PLArenaPool *poolp, 40 CMMFPKIStatusInfo *dest, 41 CMMFPKIStatusInfo *src); 42 43 extern SECStatus cmmf_CopyCertifiedKeyPair(PLArenaPool *poolp, 44 CMMFCertifiedKeyPair *dest, 45 CMMFCertifiedKeyPair *src); 46 47 extern SECStatus cmmf_DestroyPKIStatusInfo(CMMFPKIStatusInfo *info, 48 PRBool freeit); 49 50 extern SECStatus cmmf_DestroyCertOrEncCert(CMMFCertOrEncCert *certOrEncCert, 51 PRBool freeit); 52 53 extern SECStatus cmmf_PKIStatusInfoSetStatus(CMMFPKIStatusInfo *statusInfo, 54 PLArenaPool *poolp, 55 CMMFPKIStatus inStatus); 56 57 extern SECStatus cmmf_ExtractCertsFromList(CERTCertList *inCertList, 58 PLArenaPool *poolp, 59 CERTCertificate ***certArray); 60 61 extern SECStatus 62 cmmf_CertOrEncCertSetCertificate(CMMFCertOrEncCert *certOrEncCert, 63 PLArenaPool *poolp, 64 CERTCertificate *inCert); 65 66 extern CMMFPKIStatus 67 cmmf_PKIStatusInfoGetStatus(CMMFPKIStatusInfo *inStatus); 68 69 extern CERTCertList * 70 cmmf_MakeCertList(CERTCertificate **inCerts); 71 72 extern CERTCertificate * 73 cmmf_CertOrEncCertGetCertificate(CMMFCertOrEncCert *certOrEncCert, 74 CERTCertDBHandle *certdb); 75 76 extern SECStatus 77 cmmf_decode_process_cert_response(PLArenaPool *poolp, 78 CERTCertDBHandle *db, 79 CMMFCertResponse *inCertResp); 80 81 extern SECStatus 82 cmmf_decode_process_certified_key_pair(PLArenaPool *poolp, 83 CERTCertDBHandle *db, 84 CMMFCertifiedKeyPair *inCertKeyPair); 85 86 extern SECStatus 87 cmmf_user_encode(void *src, CRMFEncoderOutputCallback inCallback, void *inArg, 88 const SEC_ASN1Template *inTemplate); 89 90 extern SECStatus 91 cmmf_copy_secitem(PLArenaPool *poolp, SECItem *dest, SECItem *src); 92 #endif /*_CMMFI_H_*/