cms.h
来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 1,085 行 · 第 1/3 页
H
1,085 行
NSS_CMSSignerInfo_AddSMIMECaps(NSSCMSSignerInfo *signerinfo);/* * NSS_CMSSignerInfo_AddSMIMEEncKeyPrefs - add a SMIMEEncryptionKeyPreferences attribute to the * authenticated (i.e. signed) attributes of "signerinfo". * * This is expected to be included in outgoing signed messages for email (S/MIME). */SECStatusNSS_CMSSignerInfo_AddSMIMEEncKeyPrefs(NSSCMSSignerInfo *signerinfo, CERTCertificate *cert, CERTCertDBHandle *certdb);/* * NSS_CMSSignerInfo_AddCounterSignature - countersign a signerinfo */extern SECStatusNSS_CMSSignerInfo_AddCounterSignature(NSSCMSSignerInfo *signerinfo, SECOidTag digestalg, CERTCertificate signingcert);/* * XXXX the following needs to be done in the S/MIME layer code * after signature of a signerinfo is verified */extern SECStatusNSS_SMIMESignerInfo_SaveSMIMEProfile(NSSCMSSignerInfo *signerinfo);/* * NSS_CMSSignerInfo_IncludeCerts - set cert chain inclusion mode for this signer */extern SECStatusNSS_CMSSignerInfo_IncludeCerts(NSSCMSSignerInfo *signerinfo, NSSCMSCertChainMode cm, SECCertUsage usage);/************************************************************************ * cmsenvdata.c - CMS envelopedData methods ************************************************************************//* * NSS_CMSEnvelopedData_Create - create an enveloped data message */extern NSSCMSEnvelopedData *NSS_CMSEnvelopedData_Create(NSSCMSMessage *cmsg, SECOidTag algorithm, int keysize);/* * NSS_CMSEnvelopedData_Destroy - destroy an enveloped data message */extern voidNSS_CMSEnvelopedData_Destroy(NSSCMSEnvelopedData *edp);/* * NSS_CMSEnvelopedData_GetContentInfo - return pointer to this envelopedData's contentinfo */extern NSSCMSContentInfo *NSS_CMSEnvelopedData_GetContentInfo(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_AddRecipient - add a recipientinfo to the enveloped data msg * * rip must be created on the same pool as edp - this is not enforced, though. */extern SECStatusNSS_CMSEnvelopedData_AddRecipient(NSSCMSEnvelopedData *edp, NSSCMSRecipientInfo *rip);/* * NSS_CMSEnvelopedData_Encode_BeforeStart - prepare this envelopedData for encoding * * at this point, we need * - recipientinfos set up with recipient's certificates * - a content encryption algorithm (if none, 3DES will be used) * * this function will generate a random content encryption key (aka bulk key), * initialize the recipientinfos with certificate identification and wrap the bulk key * using the proper algorithm for every certificiate. * it will finally set the bulk algorithm and key so that the encode step can find it. */extern SECStatusNSS_CMSEnvelopedData_Encode_BeforeStart(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_Encode_BeforeData - set up encryption */extern SECStatusNSS_CMSEnvelopedData_Encode_BeforeData(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_Encode_AfterData - finalize this envelopedData for encoding */extern SECStatusNSS_CMSEnvelopedData_Encode_AfterData(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_Decode_BeforeData - find our recipientinfo, * derive bulk key & set up our contentinfo */extern SECStatusNSS_CMSEnvelopedData_Decode_BeforeData(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_Decode_AfterData - finish decrypting this envelopedData's content */extern SECStatusNSS_CMSEnvelopedData_Decode_AfterData(NSSCMSEnvelopedData *envd);/* * NSS_CMSEnvelopedData_Decode_AfterEnd - finish decoding this envelopedData */extern SECStatusNSS_CMSEnvelopedData_Decode_AfterEnd(NSSCMSEnvelopedData *envd);/************************************************************************ * cmsrecinfo.c - CMS recipientInfo methods ************************************************************************//* * NSS_CMSRecipientInfo_Create - create a recipientinfo * * we currently do not create KeyAgreement recipientinfos with multiple recipientEncryptedKeys * the certificate is supposed to have been verified by the caller */extern NSSCMSRecipientInfo *NSS_CMSRecipientInfo_Create(NSSCMSMessage *cmsg, CERTCertificate *cert);extern voidNSS_CMSRecipientInfo_Destroy(NSSCMSRecipientInfo *ri);extern intNSS_CMSRecipientInfo_GetVersion(NSSCMSRecipientInfo *ri);extern SECItem *NSS_CMSRecipientInfo_GetEncryptedKey(NSSCMSRecipientInfo *ri, int subIndex);extern SECOidTagNSS_CMSRecipientInfo_GetKeyEncryptionAlgorithmTag(NSSCMSRecipientInfo *ri);extern SECStatusNSS_CMSRecipientInfo_WrapBulkKey(NSSCMSRecipientInfo *ri, PK11SymKey *bulkkey, SECOidTag bulkalgtag);extern PK11SymKey *NSS_CMSRecipientInfo_UnwrapBulkKey(NSSCMSRecipientInfo *ri, int subIndex, CERTCertificate *cert, SECKEYPrivateKey *privkey, SECOidTag bulkalgtag);/************************************************************************ * cmsencdata.c - CMS encryptedData methods ************************************************************************//* * NSS_CMSEncryptedData_Create - create an empty encryptedData object. * * "algorithm" specifies the bulk encryption algorithm to use. * "keysize" is the key size. * * An error results in a return value of NULL and an error set. * (Retrieve specific errors via PORT_GetError()/XP_GetError().) */extern NSSCMSEncryptedData *NSS_CMSEncryptedData_Create(NSSCMSMessage *cmsg, SECOidTag algorithm, int keysize);/* * NSS_CMSEncryptedData_Destroy - destroy an encryptedData object */extern voidNSS_CMSEncryptedData_Destroy(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_GetContentInfo - return pointer to encryptedData object's contentInfo */extern NSSCMSContentInfo *NSS_CMSEncryptedData_GetContentInfo(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Encode_BeforeStart - do all the necessary things to a EncryptedData * before encoding begins. * * In particular: * - set the correct version value. * - get the encryption key */extern SECStatusNSS_CMSEncryptedData_Encode_BeforeStart(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Encode_BeforeData - set up encryption */extern SECStatusNSS_CMSEncryptedData_Encode_BeforeData(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Encode_AfterData - finalize this encryptedData for encoding */extern SECStatusNSS_CMSEncryptedData_Encode_AfterData(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Decode_BeforeData - find bulk key & set up decryption */extern SECStatusNSS_CMSEncryptedData_Decode_BeforeData(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Decode_AfterData - finish decrypting this encryptedData's content */extern SECStatusNSS_CMSEncryptedData_Decode_AfterData(NSSCMSEncryptedData *encd);/* * NSS_CMSEncryptedData_Decode_AfterEnd - finish decoding this encryptedData */extern SECStatusNSS_CMSEncryptedData_Decode_AfterEnd(NSSCMSEncryptedData *encd);/************************************************************************ * cmsdigdata.c - CMS encryptedData methods ************************************************************************//* * NSS_CMSDigestedData_Create - create a digestedData object (presumably for encoding) * * version will be set by NSS_CMSDigestedData_Encode_BeforeStart * digestAlg is passed as parameter * contentInfo must be filled by the user * digest will be calculated while encoding */extern NSSCMSDigestedData *NSS_CMSDigestedData_Create(NSSCMSMessage *cmsg, SECAlgorithmID *digestalg);/* * NSS_CMSDigestedData_Destroy - destroy a digestedData object */extern voidNSS_CMSDigestedData_Destroy(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_GetContentInfo - return pointer to digestedData object's contentInfo */extern NSSCMSContentInfo *NSS_CMSDigestedData_GetContentInfo(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Encode_BeforeStart - do all the necessary things to a DigestedData * before encoding begins. * * In particular: * - set the right version number. The contentInfo's content type must be set up already. */extern SECStatusNSS_CMSDigestedData_Encode_BeforeStart(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Encode_BeforeData - do all the necessary things to a DigestedData * before the encapsulated data is passed through the encoder. * * In detail: * - set up the digests if necessary */extern SECStatusNSS_CMSDigestedData_Encode_BeforeData(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Encode_AfterData - do all the necessary things to a DigestedData * after all the encapsulated data was passed through the encoder. * * In detail: * - finish the digests */extern SECStatusNSS_CMSDigestedData_Encode_AfterData(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Decode_BeforeData - do all the necessary things to a DigestedData * before the encapsulated data is passed through the encoder. * * In detail: * - set up the digests if necessary */extern SECStatusNSS_CMSDigestedData_Decode_BeforeData(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Decode_AfterData - do all the necessary things to a DigestedData * after all the encapsulated data was passed through the encoder. * * In detail: * - finish the digests */extern SECStatusNSS_CMSDigestedData_Decode_AfterData(NSSCMSDigestedData *digd);/* * NSS_CMSDigestedData_Decode_AfterEnd - finalize a digestedData. * * In detail: * - check the digests for equality */extern SECStatusNSS_CMSDigestedData_Decode_AfterEnd(NSSCMSDigestedData *digd);/************************************************************************ * cmsdigest.c - digestion routines ************************************************************************//* * NSS_CMSDigestContext_StartMultiple - start digest calculation using all the * digest algorithms in "digestalgs" in parallel. */extern NSSCMSDigestContext *NSS_CMSDigestContext_StartMultiple(SECAlgorithmID **digestalgs);/* * NSS_CMSDigestContext_StartSingle - same as NSS_CMSDigestContext_StartMultiple, but * only one algorithm. */extern NSSCMSDigestContext *NSS_CMSDigestContext_StartSingle(SECAlgorithmID *digestalg);/* * NSS_CMSDigestContext_Update - feed more data into the digest machine */extern voidNSS_CMSDigestContext_Update(NSSCMSDigestContext *cmsdigcx, const unsigned char *data, int len);/* * NSS_CMSDigestContext_Cancel - cancel digesting operation */extern voidNSS_CMSDigestContext_Cancel(NSSCMSDigestContext *cmsdigcx);/* * NSS_CMSDigestContext_FinishMultiple - finish the digests and put them * into an array of SECItems (allocated on poolp) */extern SECStatusNSS_CMSDigestContext_FinishMultiple(NSSCMSDigestContext *cmsdigcx, PLArenaPool *poolp, SECItem ***digestsp);/* * NSS_CMSDigestContext_FinishSingle - same as NSS_CMSDigestContext_FinishMultiple, * but for one digest. */extern SECStatusNSS_CMSDigestContext_FinishSingle(NSSCMSDigestContext *cmsdigcx, PLArenaPool *poolp, SECItem *digest);/************************************************************************ * ************************************************************************//* shortcuts for basic use *//* * NSS_CMSDEREncode - DER Encode a CMS message, with input being * the plaintext message and derOut being the output, * stored in arena's pool. */extern SECStatusNSS_CMSDEREncode(NSSCMSMessage *cmsg, SECItem *input, SECItem *derOut, PLArenaPool *arena);/************************************************************************/SEC_END_PROTOS#endif /* _CMS_H_ */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?