TrustCore SDK NanoCert API reference  version 7.0
cms.h File Reference

Header file for the Digicert SoT Platform convenience API for Cryptographic Message Syntax (CMS) support. More...

Go to the source code of this file.

Data Structures

struct  CMS_Callbacks
 Pointers to functions required by the internal CMS parser. More...
 
struct  CMSIssuerSerialNumber
 ASN1_ITEMPTR pointers for a certificate Issuer ID and serial number. More...
 
struct  CMSKeyAgreeRecipientId
 Union that identifies a CMS recipient. More...
 
struct  CMSKeyTransRecipientId
 Union that identifies a recipient for whom a transient key is wanted. More...
 
struct  CMSOriginatorPublicKey
 Union that identifies a recipient for whom a transient key is wanted. More...
 
struct  CMSRecipientId
 CMS recipient identification information. More...
 

Macros

#define NO_TAG   (0xFFFFFFFF)
 

Typedefs

typedef void * CMS_context
 
typedef void * CMS_envelopedDataContext
 
typedef 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. More...
 
typedef 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. More...
 
typedef 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. More...
 
typedef void * CMS_signedDataContext
 
typedef void * CMS_signerInfo
 
typedef MSTATUS(* CMS_ValidateRootCertificate) (const void *arg, CStream cs, ASN1_ITEM *pCertificate)
 Validate the certificates in a CMS message. More...
 

Enumerations

enum  { e_cms_signer_addCert = 0x0001, e_cms_signer_forceAuthAttr = 0x0002 }
 
enum  CMS_ContentType {
  E_CMS_undetermined = 0, E_CMS_data = 1, E_CMS_signedData = 2, E_CMS_envelopedData = 3,
  E_CMS_digestedData = 5, E_CMS_encryptedData = 6, E_CMS_ct_authData = 102
}
 

Functions

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. More...
 
MOC_EXTERN MSTATUS CMS_deleteContext (CMS_context *pContext)
 Free a CMS context structure. More...
 
MOC_EXTERN MSTATUS CMS_detachedSignature (CMS_context context, intBoolean *detached)
 Determine whether a given CMS_context is a detached signature. More...
 
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. More...
 
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. More...
 
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(). More...
 
MOC_EXTERN MSTATUS CMS_envelopedNewContext (CMS_envelopedDataContext *pNewCtx, const ubyte *encryptAlgoOID, RNGFun rngFun, void *rngFunArg)
 Create a CMS EnvelopedData object. More...
 
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. More...
 
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. More...
 
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. More...
 
MOC_EXTERN MSTATUS CMS_getDecryptingRecipient (CMS_context context, sbyte4 *recipientIndexZeroBased)
 Gets the index of the decrypting recipient in a given EnvelopedData object. More...
 
MOC_EXTERN MSTATUS CMS_getEncapContentType (CMS_context context, ubyte **ppOID)
 Get the OID (with length prefix) of the encapsulated content type. More...
 
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. More...
 
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. More...
 
MOC_EXTERN MSTATUS CMS_getNumRecipients (CMS_context context, sbyte4 *numRecipients)
 Get the number of recipients in a given CMS EnvelopedData object. More...
 
MOC_EXTERN MSTATUS CMS_getNumSigners (CMS_context context, sbyte4 *numSigners)
 Get the number of verified signers of a given SignedData object. More...
 
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. More...
 
MOC_EXTERN MSTATUS CMS_getReceiptMsgDigest (CMS_context context, const ubyte **ppDigest, ubyte4 *pDigestLen)
 Get the message digest of a given signed Receipt. More...
 
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, as well as the CStream that contains the RecipientInfo. More...
 
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. More...
 
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. More...
 
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. More...
 
MOC_EXTERN MSTATUS CMS_signedAddCertificate (CMS_signedDataContext myCtx, const ubyte *cert, ubyte4 certLen)
 Add a signed certificate to a CMS SignedData object. More...
 
MOC_EXTERN MSTATUS CMS_signedAddCRL (CMS_signedDataContext myCtx, const ubyte *crl, ubyte4 crlLen)
 Add a signed CRL to a CMS SignedData object. More...
 
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. More...
 
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. More...
 
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). More...
 
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. More...
 
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(). More...
 
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. More...
 
MOC_EXTERN MSTATUS CMS_signedNewContext (CMS_signedDataContext *pNewCtx, const ubyte *payloadTypeOID, intBoolean detached, RNGFun rngFun, void *rngFunArg)
 Create a CMS SignedData object. More...
 
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. More...
 
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. More...
 

Detailed Description

Header file for the Digicert SoT Platform convenience API for Cryptographic Message Syntax (CMS) support.