19 #ifndef __CMS_HEADER__ 20 #define __CMS_HEADER__ 28 typedef enum CMS_ContentType
30 E_CMS_undetermined = 0,
33 E_CMS_envelopedData = 3,
35 E_CMS_digestedData = 5,
36 E_CMS_encryptedData = 6,
37 E_CMS_ct_authData = 102,
76 #define NO_TAG (0xFFFFFFFF) 103 ASN1_ITEMPTR pIssuer;
104 ASN1_ITEMPTR pSerialNumber;
159 ASN1_ITEMPTR subjectKeyIdentifier;
209 ASN1_ITEMPTR pAlgoOID;
210 ASN1_ITEMPTR pAlgoParameters;
211 ASN1_ITEMPTR pPublicKey;
286 ASN1_ITEMPTR subjectKeyIdentifier;
292 typedef struct CMSKEKRecipientId
294 ASN1_ITEMPTR keyIdentifer;
350 CMSKEKRecipientId kekrid;
351 CMSPasswordRecipientId pwrdi;
352 CMSOtherRecipientId orid;
426 AsymmetricKey* pKey);
469 ASN1_ITEM* pCertificate);
511 ASN1_ITEM* pSerialNumber,
512 ASN1_ITEM* pIssuerName,
513 ubyte** ppCertificate,
514 ubyte4* certificateLen);
577 const ubyte *digestAlgoOID,
578 const ubyte *pDataToSign,
579 ubyte4 dataToSignLen,
581 ubyte4 sigBufferLen);
631 const void* callbackArg,
669 ubyte4 inputLen, ubyte** ppOutput,
670 ubyte4* pOutputLen, intBoolean* pFinished);
704 MOC_EXTERN MSTATUS CMS_createContentInfo(
const ubyte* contentType, DER_ITEMPTR *ppContentInfo, DER_ITEMPTR *ppContent);
737 MOC_EXTERN MSTATUS
CMS_getContentType( CMS_context context, CMS_ContentType* cmsContentType);
776 ubyte4 inputLen, CMS_ContentType* cType);
843 sbyte4* numRecipients);
891 sbyte4 recipientIndexZeroBased,
892 const ASN1_ITEM** pRecipientInfo,
926 sbyte4* recipientIndexZeroBased);
964 ubyte** ppEncryptionAlgoOID);
1002 sbyte4* numSigners);
1043 const ASN1_ITEM** ppRecipientInfo,
1090 const ubyte** messageId, ubyte4* messageIdLen,
1091 const ubyte** signature, ubyte4* signatureLen);
1122 const ubyte** ppDigest, ubyte4* pDigestLen);
1165 const ASN1_ITEM** ppCertificate,
1236 ubyte4 payloadLen, intBoolean
final);
1297 RNGFun rngFun,
void* rngFunArg,
1298 const ubyte* signerCert, ubyte4 signerCertLen,
1299 const AsymmetricKey* pKey,
const ubyte* hashAlgoOID,
1300 ubyte** ppReceipt, ubyte4* pReceiptLen);
1367 const ubyte* payloadTypeOID,
1368 intBoolean detached, RNGFun rngFun,
1427 MOC_EXTERN MSTATUS
CMS_signedAddCRL( CMS_signedDataContext myCtx,
const ubyte* crl,
1432 e_cms_signer_addCert = 0x0001,
1433 e_cms_signer_forceAuthAttr = 0x0002
1480 const AsymmetricKey* pKey,
1481 const ubyte* digestAlgoOID,
1483 CMS_signerInfo* pNewSignerInfo);
1530 CMS_signedDataContext myCtx,
1535 const ubyte* digestAlgoOID,
1537 CMS_signerInfo* pNewSignerInfo);
1598 const ubyte* typeOID,
1602 intBoolean authenticated);
1636 CMS_signedDataContext myCtx,
1637 const ubyte** receiptFrom,
1638 sbyte4 numReceiptFrom,
1639 const ubyte** receiptTo,
1640 sbyte4 numReceiptTo);
1691 const ubyte** messageId, ubyte4* messageIdLen,
1692 const ubyte** digest, ubyte4* digestLen,
1693 const ubyte** signature, ubyte4* signatureLen);
1733 CMS_signedDataContext myCtx,
1734 const ubyte* data, ubyte4 dataLen,
1735 ubyte** ppOutput, ubyte4* pOutputLen,
1736 intBoolean finished);
1764 CMS_signedDataContext* ppCtx);
1823 const ubyte* encryptAlgoOID,
1824 RNGFun rngFun,
void* rngFunArg);
1855 const ubyte* cert, ubyte4 certLen);
1889 const ubyte* typeOID,
1932 CMS_envelopedDataContext myCtx,
1933 const ubyte* data, ubyte4 dataLen,
1934 ubyte** ppOutput, ubyte4* pOutputLen,
1935 intBoolean finished);
1963 CMS_envelopedDataContext* ppCtx);
MOC_EXTERN MSTATUS CMS_getSignerInfo(CMS_context context, sbyte4 index, const ASN1_ITEM **ppRecipientInfo, CStream *pCS)
Get the SignerInfo object for a given verified signer.
MOC_EXTERN MSTATUS CMS_envelopedAddRecipient(CMS_envelopedDataContext myCtx, const ubyte *cert, ubyte4 certLen)
Add a recipient, identified by its DER-encoded certificate, to a CMS EnvelopedData object...
MOC_EXTERN MSTATUS CMS_createSignedReceipt(CMS_context context, sbyte4 index, RNGFun rngFun, void *rngFunArg, const ubyte *signerCert, ubyte4 signerCertLen, const AsymmetricKey *pKey, const ubyte *hashAlgoOID, ubyte **ppReceipt, ubyte4 *pReceiptLen)
Create a signed Receipt on the given message for a given signer.
Union that identifies a recipient for whom a transient key is wanted.
Definition: cms.h:153
MOC_EXTERN MSTATUS CMS_getEncapContentType(CMS_context context, ubyte **ppOID)
Get the OID (with length prefix) of the encapsulated content type.
MOC_EXTERN MSTATUS CMS_signedAddSignerWithCallback(MOC_HW(hwAccelDescr hwAccelCtx) CMS_signedDataContext myCtx, const ubyte *cert, ubyte4 certLen, CMS_SignData signCallback, void *pCbInfo, const ubyte *digestAlgoOID, ubyte4 flags, CMS_signerInfo *pNewSignerInfo)
Add a signer to a given SignedData object when the private key is unavailable.
MOC_EXTERN MSTATUS CMS_signedAddSignerAttribute(CMS_signedDataContext myCtx, CMS_signerInfo signerInfo, const ubyte *typeOID, ubyte4 type, const ubyte *value, ubyte4 valueLen, intBoolean authenticated)
Add an attribute (authenticated or non-authenticated) to a CMS SignedData object's signer(s)...
MOC_EXTERN MSTATUS CMS_deleteContext(CMS_context *pContext)
Free a CMS context structure.
MSTATUS(* CMS_SignData)(void *pCbInfo, const ubyte *digestAlgoOID, const ubyte *pDataToSign, ubyte4 dataToSignLen, ubyte *pSigBuffer, ubyte4 sigBufferLen)
This callback is used to perform a signature operation.
Definition: cms.h:576
MOC_EXTERN MSTATUS CMS_getEncryptionAlgo(CMS_context context, ubyte **ppEncryptionAlgoOID)
Get the OID (with prefix length) of the encryption algorithm of a given CMS_context.
CMS recipient identification information.
Definition: cms.h:342
MOC_EXTERN MSTATUS CMS_signedUpdateContext(MOC_ASYM(hwAccelDescr hwAccelCtx) CMS_signedDataContext myCtx, const ubyte *data, ubyte4 dataLen, ubyte **ppOutput, ubyte4 *pOutputLen, intBoolean finished)
Add data to a CMS SignedData object.
Union that identifies a recipient for whom a transient key is wanted.
Definition: cms.h:207
MOC_EXTERN MSTATUS CMS_signedAddCertificate(CMS_signedDataContext myCtx, const ubyte *cert, ubyte4 certLen)
Add a signed certificate to a CMS SignedData object.
MOC_EXTERN MSTATUS CMS_newContext(CMS_context *pNewContext, const void *callbackArg, const CMS_Callbacks *pCallbacks)
Create a CMS context structure for parsing a received CMS object.
MOC_EXTERN MSTATUS CMS_getContentType(CMS_context context, CMS_ContentType *cmsContentType)
Get the ContentType (CMS_contentType enumerated value from cms.h) of a given CMS object.
MOC_EXTERN MSTATUS CMS_envelopedNewContext(CMS_envelopedDataContext *pNewCtx, const ubyte *encryptAlgoOID, RNGFun rngFun, void *rngFunArg)
Create a CMS EnvelopedData object.
MOC_EXTERN MSTATUS CMS_getReceiptInfo(const ubyte *receipt, ubyte4 receiptLen, const ubyte **messageId, ubyte4 *messageIdLen, const ubyte **signature, ubyte4 *signatureLen)
Get message ID and signature of a given signed Receipt.
Information about a SignedData object's signer.
Definition: pkcs7.h:91
Pointers to functions required by the internal CMS parser.
Definition: cms.h:530
MOC_EXTERN MSTATUS CMS_getNumRecipients(CMS_context context, sbyte4 *numRecipients)
Get the number of recipients in a given CMS EnvelopedData object.
MOC_EXTERN MSTATUS CMS_getNumSigners(CMS_context context, sbyte4 *numSigners)
Get the number of verified signers of a given SignedData object.
MOC_EXTERN MSTATUS CMS_signedGetRequestInfo(CMS_signedDataContext myCtx, CMS_signerInfo signerInfo, const ubyte **messageId, ubyte4 *messageIdLen, const ubyte **digest, ubyte4 *digestLen, const ubyte **signature, ubyte4 *signatureLen)
Extract receipt request information.
ASN1_ITEMPTR pointers for a certificate Issuer ID and serial number.
Definition: cms.h:101
MOC_EXTERN MSTATUS CMS_signedAddSigner(CMS_signedDataContext myCtx, const ubyte *cert, ubyte4 certLen, const AsymmetricKey *pKey, const ubyte *digestAlgoOID, ubyte4 flags, CMS_signerInfo *pNewSignerInfo)
Add a signer to a given SignedData object.
MOC_EXTERN MSTATUS CMS_signedDeleteContext(MOC_HASH(hwAccelDescr hwAccelCtx) CMS_signedDataContext *ppCtx)
Delete and free a CMS SignedData object that was allocated by CMS_signedNewContext().
MOC_EXTERN MSTATUS CMS_getDecryptingRecipient(CMS_context context, sbyte4 *recipientIndexZeroBased)
Gets the index of the decrypting recipient in a given EnvelopedData object.
MOC_EXTERN MSTATUS CMS_signedNewContext(CMS_signedDataContext *pNewCtx, const ubyte *payloadTypeOID, intBoolean detached, RNGFun rngFun, void *rngFunArg)
Create a CMS SignedData object.
CMS_GetPrivateKey getPrivKeyFun
Pointer to the CMS_GetPrivateKey() callback function.
Definition: cms.h:536
ubyte4 type
Tells you how to interpret the u member of a CMSKeyAgreeRecipientId structure.
Definition: cms.h:278
void * CMS_signedDataContext
Definition: cms.h:57
MOC_EXTERN MSTATUS CMS_envelopedAddUnauthAttribute(CMS_envelopedDataContext myCtx, const ubyte *typeOID, ubyte4 type, const ubyte *value, ubyte4 valueLen)
Add an unauthenticated attribute to a CMS EnvelopedData object.
MOC_EXTERN MSTATUS CMS_setDetachedSignatureData(CMS_context context, const ubyte *payload, ubyte4 payloadLen, intBoolean final)
Add payload information to a CMS_context so that it can verify a detached signature.
MSTATUS(* CMS_GetCertificate)(const void *arg, CStream cs, ASN1_ITEM *pSerialNumber, ASN1_ITEM *pIssuerName, ubyte **ppCertificate, ubyte4 *certificateLen)
Return a message's certificate that matches a given serial number and issuer name.
Definition: cms.h:510
MSTATUS(* CMS_GetPrivateKey)(const void *arg, CStream cs, const CMSRecipientId *pRecipientId, AsymmetricKey *pKey)
Get the private key associated with a given certificate in a CMS message stream.
Definition: cms.h:423
MOC_EXTERN MSTATUS CMS_getRecipientInfo(CMS_context context, sbyte4 recipientIndexZeroBased, const ASN1_ITEM **pRecipientInfo, CStream *pCS)
Get offset and length information of a given RecipientInfo object in a given EnvelopedData object...
MOC_EXTERN MSTATUS CMS_updateContext(CMS_context context, const ubyte *input, ubyte4 inputLen, ubyte **ppOutput, ubyte4 *pOutputLen, intBoolean *pFinished)
Add data to a CMS_context object.
MOC_EXTERN MSTATUS CMS_getContentTypeOnly(CMS_context context, const ubyte *pInput, ubyte4 inputLen, CMS_ContentType *cType)
Get the ContentType (CMS_contentType enumerated value from cms.h) of a given data buffer input...
Union that identifies a CMS recipient.
Definition: cms.h:270
void * CMS_context
Definition: cms.h:47
CMS_ValidateRootCertificate valCertFun
Pointer to the CMS_ValidateRootCertificate() callback function.
Definition: cms.h:541
MOC_EXTERN MSTATUS CMS_signedAddCRL(CMS_signedDataContext myCtx, const ubyte *crl, ubyte4 crlLen)
Add a signed CRL to a CMS SignedData object.
MSTATUS(* CMS_ValidateRootCertificate)(const void *arg, CStream cs, ASN1_ITEM *pCertificate)
Validate the certificates in a CMS message.
Definition: cms.h:467
MOC_EXTERN MSTATUS CMS_signedAddReceiptRequest(MOC_HASH(hwAccelDescr hwAccelCtx) CMS_signedDataContext myCtx, const ubyte **receiptFrom, sbyte4 numReceiptFrom, const ubyte **receiptTo, sbyte4 numReceiptTo)
Request a receipt for a given message.
MOC_EXTERN MSTATUS CMS_envelopedDeleteContext(MOC_SYM(hwAccelDescr hwAccelCtx) CMS_envelopedDataContext *ppCtx)
Delete and free a CMS EnvelopedData object that was allocated by CMS_envelopedNewContext().
MOC_EXTERN MSTATUS CMS_envelopedUpdateContext(MOC_HW(hwAccelDescr hwAccelCtx) CMS_envelopedDataContext myCtx, const ubyte *data, ubyte4 dataLen, ubyte **ppOutput, ubyte4 *pOutputLen, intBoolean finished)
Add data to a CMS EnvelopedData object.
MOC_EXTERN MSTATUS CMS_detachedSignature(CMS_context context, intBoolean *detached)
Determine whether a given CMS_context is a detached signature.
CMS_GetCertificate getCertFun
Pointer to the CMS_GetCertificate() callback function.
Definition: cms.h:546
void * CMS_envelopedDataContext
Definition: cms.h:73
MOC_EXTERN MSTATUS CMS_getReceiptMsgDigest(CMS_context context, const ubyte **ppDigest, ubyte4 *pDigestLen)
Get the message digest of a given signed Receipt.
void * CMS_signerInfo
Definition: cms.h:65
MOC_EXTERN MSTATUS CMS_getFirstCertificate(CMS_context context, const ASN1_ITEM **ppCertificate, CStream *pCS)
Get the first certificate (its ASN1_ITEM structure) in a given CMS_context SignedData object...