TrustCore SDK NanoCert API reference  version 7.0
CMS (Cryptographic Message Syntax) Functions

Provides CMS (Cryptographic Message Syntax) streaming functionality. More...

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

Function Documentation

◆ CMS_createSignedReceipt()

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 
)

This function creates a signed Receipt object for the given message and signer. A signed Receipt object is a Receipt object that is encapsulated within a SignedData object.

For details about Receipt and signed Receipt objects, refer to RFC 2634.

(FIPS-compliance info in rngFun parameter desc)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS context structure for the SignedData object for which you want to create a signed Receipt.
indexIndex value indicating the verified signer of the SignedData object for which you want to generate a signed Receipt.
rngFunPointer to a function that generates random numbers suitable for cryptographic use. To be FIPS-compliant, reference RANDOM_rngFun() (defined in random.c), and make sure that __ENABLE_MOCANA_FIPS_MODULE__ is defined in moptions.h
rngFunArgPointer to arguments that are required by the function referenced in rngFun. If you use RANDOM_rngFun(), you must supply a randomContext structure, which you can create by calling RANDOM_acquireContext().
signerCertPointer to a DER-encoded certificate for the signer of the signed Receipt to create.
signerCertLenLength of the DER-encoded certificate, signerCert.
pKeyPointer to an AsymmetricKey structure containing the signer's private key, which is used to sign the Receipt.
hashAlgoOIDPointer to the OID for the message digest method to use for this signer. Valid values are pointers to md5_OID or sha1_OID, which are defined in src/asn1/oiddefs.h.
ppReceiptOn return, pointer to the signed Receipt object, which is encapsulated in a SignedData object.
pReceiptLenOn return, pointer to the length of the signed Receipt object, ppReceipt.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_deleteContext()

MOC_EXTERN MSTATUS CMS_deleteContext ( CMS_context pContext)

This function frees (releases) a CMS context structure.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
pContextPointer to the CMS context structure to free.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_detachedSignature()

MOC_EXTERN MSTATUS CMS_detachedSignature ( CMS_context  context,
intBoolean *  detached 
)

This function determines whether a given CMS_context is a detached signature — a SignedData object that contains the signature that would otherwise be included in a different CMS_context.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context of interest.
detachedOn return, pointer to TRUE if the context is a detached signature; otherwise pointer to FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_envelopedAddRecipient()

MOC_EXTERN MSTATUS CMS_envelopedAddRecipient ( CMS_envelopedDataContext  myCtx,
const ubyte *  cert,
ubyte4  certLen 
)

This function adds a recipient to a CMS EnvelopedData object. You identify the recipient using its DER-encoded certificate.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to CMS EnvelopedData object to which to add a recipient.
certPointer to the recipients's DER-encoded certificate.
certLenLength of the certificate buffer, cert.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_envelopedAddUnauthAttribute()

MOC_EXTERN MSTATUS CMS_envelopedAddUnauthAttribute ( CMS_envelopedDataContext  myCtx,
const ubyte *  typeOID,
ubyte4  type,
const ubyte *  value,
ubyte4  valueLen 
)

This function adds an unauthenticated attribute to a CMS EnvelopedData object.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS EnvelopedData object to which to add the unauthenticated attribute.
typeOIDPointer to OID value specifying the data type of enveloped data.
typePointer to content type of the enveloped data.
valuePointer to unauthenticated attribute to add.
valueLenLength of the unauthenticated attribute to add, value.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_envelopedDeleteContext()

MOC_EXTERN MSTATUS CMS_envelopedDeleteContext ( MOC_SYM(hwAccelDescr hwAccelCtx) CMS_envelopedDataContext ppCtx)

This function deletes and frees a CMS EnvelopedData object that was allocated by CMS_envelopedNewContext().

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
ppCtxPointer to CMS EnvelopedData object to delete and free.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_envelopedNewContext()

MOC_EXTERN MSTATUS CMS_envelopedNewContext ( CMS_envelopedDataContext pNewCtx,
const ubyte *  encryptAlgoOID,
RNGFun  rngFun,
void *  rngFunArg 
)

This function creates a CMS EnvelopedData object. After you call this function, you must call other functions to populate the object.

Note
To create a new CMS context structure, do not use this function, which creates a CMS EnvelopedData object. Instead, use CMS_newContext().

To delete and free the EnvelopedData object, call CMS_envelopedDeleteContext().

See also
CMS_envelopedAddRecipient()
CMS_envelopedAddUnauthAttribute()
CMS_envelopedUpdateContext()
CMS_envelopedDeleteContext()

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
pNewCtxOn return, pointer to the new EnvelopedData object.
encryptAlgoOIDPointer to OID array that describes the type of encryption to apply to the EnvelopedData object. Use any of the preconfigured OID arrays from src/asn1/oiddefs.h:
  • aes128CBC_OID
  • aes192CBC_OID
  • aes256CBC_OID
rngFunPointer to a function that generates random numbers suitable for cryptographic use. To be FIPS-compliant, reference RANDOM_rngFun() (defined in random.c), and make sure that __ENABLE_MOCANA_FIPS_MODULE__ is defined in moptions.h
rngFunArgPointer to arguments that are required by the function referenced in rngFun. If you use RANDOM_rngFun(), you must supply a randomContext structure, which you can create by calling RANDOM_acquireContext().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

(FIPS-compliance info in rngFun parameter description.)

cms.h

◆ CMS_envelopedUpdateContext()

MOC_EXTERN MSTATUS CMS_envelopedUpdateContext ( MOC_HW(hwAccelDescr hwAccelCtx) CMS_envelopedDataContext  myCtx,
const ubyte *  data,
ubyte4  dataLen,
ubyte **  ppOutput,
ubyte4 *  pOutputLen,
intBoolean  finished 
)

This function adds data to a CMS EnvelopedData object.

Note
In streaming mode, output must be quick. As soon as all the data is in, call this function with the finished parameter equal to TRUE, which indicates that all the data is in and that the CMS can be generated in its entirety.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to CMS EnvelopedData object to which to add data.
dataPointer to the data to add.
dataLenLength of the data to add, data.
ppOutputOn return, if finished is TRUE, pointer to the address of the DER-encoded, signed CMS EnvelopedData object.
pOutputLenOn return, if finished is TRUE, pointer to the length of the DER-encoded, signed CMS object, ppOutput.
finishedTRUE if this function supplies the last data to add; otherwise FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getContentType()

MOC_EXTERN MSTATUS CMS_getContentType ( CMS_context  context,
CMS_ContentType *  cmsContentType 
)

This function returns the ContentType (CMS_contentType enumerated value from cms.h) of a given CMS object, through the cmsContentType parameter.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS object from which to extract the ContentType.
cmsContentTypeOn return, pointer to a CMS_ContentType enumerated value (see cms.h).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getContentTypeOnly()

MOC_EXTERN MSTATUS CMS_getContentTypeOnly ( CMS_context  context,
const ubyte *  pInput,
ubyte4  inputLen,
CMS_ContentType *  cType 
)

This function returns the ContentType (CMS_contentType enumerated value from cms.h) of the input data buffer, through the cType parameter. Note that this call will only return accurate information on the first data buffer.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context object
pInputPointer to the data from which to ascertain the ContentType
inputLenLength of the data to add, input.
cTypeOn return, pointer to a CMS_ContentType enumerated value (see cms.h).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getDecryptingRecipient()

MOC_EXTERN MSTATUS CMS_getDecryptingRecipient ( CMS_context  context,
sbyte4 *  recipientIndexZeroBased 
)

This function returns the index of the decrypting recipient in a given EnvelopedData object, through the recipientIndexZeroBased parameter.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS context structure of the EnvelopedData object to query.
recipientIndexZeroBasedOn return, pointer to the zero-based index of the decrypting recipient in the EnvelopedData object.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getEncapContentType()

MOC_EXTERN MSTATUS CMS_getEncapContentType ( CMS_context  context,
ubyte **  ppOID 
)

This function returns the OID (with length prefix) of the encapsulated content type of a given CMS_context, through the ppOID parameter.

Warning
This function allocates memory for the ppOID buffer. To avoid memory leaks, you must free the buffer when you are done with it.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS context from which to extract the OID.
ppOIDOn return, pointer to the address of an OID value. The value's buffer is allocated by this function, and you must free it when you are done with it.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getEncryptionAlgo()

MOC_EXTERN MSTATUS CMS_getEncryptionAlgo ( CMS_context  context,
ubyte **  ppEncryptionAlgoOID 
)

This function returns the OID (with prefix length) of the encryption algorithm of a given CMS_context, through the ppEncryptionAlgoOID parameter.

Warning
This function allocates memory for the ppEncryptionAlgoOID buffer. To avoid memory leaks, you must free the buffer when you are done with it.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context for the EnvelopedData object to query.
ppEncryptionAlgoOIDOn return, pointer to the address of a buffer that contains the OID (with prefix length) of the encryption algorithm. value's buffer is allocated by this function, and you must free it when you are done with it.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getFirstCertificate()

MOC_EXTERN MSTATUS CMS_getFirstCertificate ( CMS_context  context,
const ASN1_ITEM **  ppCertificate,
CStream *  pCS 
)

This function Get the first certificate (its ASN1_ITEM structure) in a givenCMS_context SignedData object. The ASN1_ITEM structure contains offset and length information for the certificate that is in the returned CStream, pCS.

To get subsequent certificates, use ASN1_NEXT_SIBLING.

(Pls clarify how to "use ASN1_NEXT_SIBLING" to get subsequent certificates.)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context for the SignedData object from which to get its first certificate.
ppCertificateOn return, pointer to the address of the ASN1_ITEM structure for the found certificate. This structure contains offset and length information for the certificate, which is in the CStream, pCS.
pCSOn return, pointer to the CStream that contains the ASN1_ITEM structure, ppCertificate, of the first certificate.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getNumRecipients()

MOC_EXTERN MSTATUS CMS_getNumRecipients ( CMS_context  context,
sbyte4 *  numRecipients 
)

This function returns the number of recipients in the referenced CMS EnvelopedData object, through the numRecipients parameter. If the recipients are not all in the EnvelopedData object, this function returns an error (ERR_EOF).

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextEnvelopedData object from which to extract the number of recipients.
numRecipientsOn return, pointer to the number of recipients in the referenced EnvelopedData object, context.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getNumSigners()

MOC_EXTERN MSTATUS CMS_getNumSigners ( CMS_context  context,
sbyte4 *  numSigners 
)

This function returns the number of verified signers of a given SignedData object, returned through the numSigners parameter.

If you do not know whether the given SignedData object is a detached signature, before calling this function you should call CMS_detachedSignature(). If the SignedData object is a detached signature, you must call CMS_setDetachedSignatureData() before calling the CMS_getNumSigners function. Otherwise, the CMS_getNumSigners function cannot verify the signers, and will return the error, ERR_PKCS7_DETACHED_DATA.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context structure that contains the SignedData object of interest.
numSignersOn return, pointer to the number of verified signers.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getReceiptInfo()

MOC_EXTERN MSTATUS CMS_getReceiptInfo ( const ubyte *  receipt,
ubyte4  receiptLen,
const ubyte **  messageId,
ubyte4 *  messageIdLen,
const ubyte **  signature,
ubyte4 *  signatureLen 
)

This function gets the message ID and signature of a given signed Receipt.

Call this function after the signedData has been parsed and the signature(s) verified. The encapsulated Content Type (see CMS_getEncapContentType()) is id-ct-receipt. The receipt is the signed data (which is built by concatenating the CMS_updateContext object's returned buffers).

Warning
The returned pointers point to data inside the input receipt buffer. Do not free these pointers.

(confusing description in inherited Doxygen comments)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
receiptPointer to signed Receipt of interest.
receiptLenLength of the Receipt buffer, receipt.
messageIdOn return, pointer the address of an offset into the signed Receipt for the message ID.
messageIdLenOn return, pointer to length of the message ID, messageId.
signatureOn return, pointer to the address of an offset into the signed Receipt for the signature.
signatureLenOn return, pointer to the length of the signature, signature.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getReceiptMsgDigest()

MOC_EXTERN MSTATUS CMS_getReceiptMsgDigest ( CMS_context  context,
const ubyte **  ppDigest,
ubyte4 *  pDigestLen 
)

This function gets the message digest of a given signed Receipt.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to CMS_context for the signed Receipt object of interest.
ppDigestOn return, pointer to the address of a buffer containing the message digest of the signed Receipt.
pDigestLenOn return, pointer to the length of the message digest buffer, ppDigest.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getRecipientInfo()

MOC_EXTERN MSTATUS CMS_getRecipientInfo ( CMS_context  context,
sbyte4  recipientIndexZeroBased,
const ASN1_ITEM **  pRecipientInfo,
CStream *  pCS 
)

This function returns the offset and length information of a given RecipientInfo object in a given EnvelopedData (CMS_context) object, as well as the CStream that contains the RecipientInfo.

You can use the offset and length information, which is returned through the pRecipientInfo parameter, to find the RecipientInfo object in the returned CStream. If the recipient is not in the EnvelopedData (CMS_context) object, this function returns an error (ERR_EOF).

(there's contradictory info in inherited Doxygen documentation.)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS context structure for the EnvelopedData object from which you want to extract a RecipientInfo object.
recipientIndexZeroBasedZero-based index of the RecipientInfo object of interest in the EnvelopedData object, context. (To get the size of the EnvelopedData array, call CMS_getNumRecipients().)
pRecipientInfoOn return, pointer to the address of an ASN1_ITEM structure that contains offset and length information for the RecipientInfo object of interest.
pCSOn return, pointer to the CStream that contains the RecipientInfo object of interest.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_getSignerInfo()

MOC_EXTERN MSTATUS CMS_getSignerInfo ( CMS_context  context,
sbyte4  index,
const ASN1_ITEM **  ppRecipientInfo,
CStream *  pCS 
)

Call this function to get an ASN1_ITEM structure that provides the offset and length information for a SignerInfo object for a verified signer of the given SignedData object.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context structure containing the SignedData object from which to extract the SignerInfo object.
indexZero-based index of the SignerInfo object of interest in the SignedData object that is in context. (To get the size of the SignedData array, call CMS_getNumSigners().)
ppRecipientInfoOn return, pointer to the address of an ASN1_ITEM structure that contains offset and length information for the SignerInfo object of interest.
pCSOn return, pointer to the CStream that contains the SignedData object of interest.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_newContext()

MOC_EXTERN MSTATUS CMS_newContext ( CMS_context pNewContext,
const void *  callbackArg,
const CMS_Callbacks pCallbacks 
)

This function creates a CMS context structure, initializes its state, and populates its callback pointers with the passed-in function pointers, pCallbacks.

Use this function to parse a received CMS object. The CMS context structure, pNewContext, contains information required to parse a CMS message. Treat this structure as opaque, and do not attempt to access its members directly.

Note
To create a new CMS object, do not use CMS_newContext(), which creates a context structure, not a CMS object. Instead, use CMS_signedNewContext() to create a new SignedData object, or use CMS_envelopedNewContext() to create a new EnvelopedData object.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
pNewContextOn return, pointer to a MS_context structure, which maintains context information required by functions that parse a CMS message. Treat this structure as opaque, and do not access its members directly.
callbackArgPointer to arguments that are required by the function referenced in pCallbacks.
pCallbacksPointer to a populated CMS_Callbacks structure containing pointers to functions for obtaining the private key for a particular subject, for validating a root certificate, and for searching a CStream for a certificate that matches a specified issuer name and serial number.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_setDetachedSignatureData()

MOC_EXTERN MSTATUS CMS_setDetachedSignatureData ( CMS_context  context,
const ubyte *  payload,
ubyte4  payloadLen,
intBoolean  final 
)

This function adds payload information to a CMS_context so that it can verify a detached signature — a SignedData object that contains the signature that would otherwise be included in the CMS_context.

(There are confusing statements in inherited Doxygen documentation.)

To enable this function, at least one of the following flags must be defined in moptions.h:`

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context structure that contains the SignedData object that is an external signature for the data in the buffer, payload.
On return, also contains the information that is required to verify the SignedData object's detached signature.
payloadPointer to the buffer containing the data that is signed by the context object's SignedData object.
payloadLenLength of the signed data, payload.
finalTRUE if all the data is already added; otherwise FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddCertificate()

MOC_EXTERN MSTATUS CMS_signedAddCertificate ( CMS_signedDataContext  myCtx,
const ubyte *  cert,
ubyte4  certLen 
)

This function adds a signed certificate to CMS SignedData object. This function can add an intermediate certificate.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS SignedData object to which to add a certificate.
certPointer to DER-encoded certificate to add.
certLenLength of the certificate buffer, cert.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddCRL()

MOC_EXTERN MSTATUS CMS_signedAddCRL ( CMS_signedDataContext  myCtx,
const ubyte *  crl,
ubyte4  crlLen 
)

This function adds a signed CRL (Certificate Revocation List) to a CMS SignedData object.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to CMS SignedData object to which to add a CRL.
crlPointer to the DER-encoded CRL to add.
crlLenLength of the CRL buffer, crl.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddReceiptRequest()

MOC_EXTERN MSTATUS CMS_signedAddReceiptRequest ( MOC_HASH(hwAccelDescr hwAccelCtx) CMS_signedDataContext  myCtx,
const ubyte **  receiptFrom,
sbyte4  numReceiptFrom,
const ubyte **  receiptTo,
sbyte4  numReceiptTo 
)

This function requests a receipt for a given message.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS SignedData object containing the signer(s) to which to add a receipt request.
receiptFromArray of recipient email addresses from which receipts are requested.
numReceiptFrom-1 for all; 0 for not on mailing list; >0 to use the receiptFrom value.
receiptToArray of email addresses to which to send receipts.
numReceiptTo-1 for all; 0 for not on mailing list; >0 to use the receiptTo value.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddSigner()

MOC_EXTERN MSTATUS CMS_signedAddSigner ( CMS_signedDataContext  myCtx,
const ubyte *  cert,
ubyte4  certLen,
const AsymmetricKey *  pKey,
const ubyte *  digestAlgoOID,
ubyte4  flags,
CMS_signerInfo pNewSignerInfo 
)

This function adds a signer, and optionally a certificate and authenticated atrributes, to a given SignedData object.

(Does this function "add" or "allocate, initialize, and populate"?)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS context for the SignedData object to which to add a signer.
certPointer to signer's DER-encoded certificate.
certLenLength of the signer's DER-encoded certificate, cert.
pKeyPointer to signer's key, an AsymetricKey structure.
digestAlgoOIDPointer to the OID for the message digest method to use for the signer. Valid values are md5_OID or sha1_OID, defined in src/asn1/oiddefs.h.
flagsZero (0) or bitmask combination (created by ORing definitions together) specifying which signing elements to include (defined in cms.h):
  • e_cms_signer_addCert — Add the certificate to the CMS context.
  • e_cms_signer_forceAuthAttr — Add authenticate attributes.
pNewSignerInfoOn return, pointer to a newly allocated CMS_signerInfo structure (an opaque structure).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddSignerAttribute()

MOC_EXTERN MSTATUS CMS_signedAddSignerAttribute ( CMS_signedDataContext  myCtx,
CMS_signerInfo  signerInfo,
const ubyte *  typeOID,
ubyte4  type,
const ubyte *  value,
ubyte4  valueLen,
intBoolean  authenticated 
)

This function adds an attribute (authenticated or non-authenticated) to a CMS SignedData object's signer(s).

To add an authenticated signer attribute, RFC 5652 requires that you add at least two attributes:

  • A content-type attribute specifying the content type of the EncapsulatedContentInfo value being signed.
  • A message-digest attribute, specifying the message digest of the content.

A typical function call is similar to the following:

CMS_signedAddSignerAttribute(
    myCtx,
    mySigner,
    pkcs9_emailAddress_OID,
    PRINTABLESTRING,
    (const ubyte*) "nobody@mocana.com",
    17,
    1)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS SignedData object containing the signer(s) to which to add an attributed.
signerInfoZero (0) to add the attribute to all signers; otherwise pointer to the CMS_signerInfo structure, created by CMS_signedAddSigner(), for the signer to which to add the attribute.
typeOIDOID specifying the type of signer attribute to add, such as pkcs9_emailAddress_OID.
typeOID specifying the content type of the signer attribute; for example, the PRINTABLESTRING constant defined in src/asn1/parseasn1.h.
valuePointer to the signer attribute to add; for example, "nobody@mocana.com".
valueLenLength of the signer attribute to add, value.
authenticatedTRUE if the signer attribute to add, value, is an authenticated attribute; otherwise FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedAddSignerWithCallback()

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. Later a callback will be used to perform the signing operation.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS context for the SignedData object to which to add a signer.
certPointer to signer's DER-encoded certificate.
certLenLength of the signer's DER-encoded certificate, cert.
signCallbackCallback that will perform a signing operation given the proper inputs.
pCbInfoOptional callback argument that may be needed by your implementation.
digestAlgoOIDPointer to the OID for the message digest method to use for the signer. Valid values are md5_OID or sha1_OID, defined in src/asn1/oiddefs.h.
flagsZero (0) or bitmask combination (created by ORing definitions together) specifying which signing elements to include (defined in cms.h):
  • e_cms_signer_addCert—Add the certificate to the CMS context.
  • e_cms_signer_forceAuthAttr—Add authenticate attributes.
pNewSignerInfoOn return, pointer to a newly allocated CMS_signerInfo structure (an opaque structure).
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedDeleteContext()

MOC_EXTERN MSTATUS CMS_signedDeleteContext ( MOC_HASH(hwAccelDescr hwAccelCtx) CMS_signedDataContext ppCtx)

This function deletes and frees a CMS SignedData object that was allocated by CMS_signedNewContext().

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
ppCtxPointer to CMS SignedData object to delete and free.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedGetRequestInfo()

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 
)

This function extracts receipt request information, which should be saved for processing the receipt when it arrives.

Do not call this function until after:

Warning
The returned pointers point to data inside the CMS_signedDataContext structure. Do not free these pointers. If the CMS_signedDataContext structure is deleted, these pointers become invalid.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS SignedData object from which to extract receipt request information.
signerInfoPointer to the CMS_signerInfo structure, created by CMS_signedAddSigner(), for the signer from which to extract receipt request information.
messageIdOn return, pointer the address of an offset into the signed Receipt for the message ID.
messageIdLenOn return, pointer to length of the message ID, messageId.
digestOn return, pointer the address of an offset into the signed Receipt for the message digest.
digestLenOn return, pointer to length of the message digest, digest.
signatureOn return, pointer the address of an offset into the signed Receipt for the signature.
signatureLenOn return, pointer to length of the signature, signature.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedNewContext()

MOC_EXTERN MSTATUS CMS_signedNewContext ( CMS_signedDataContext pNewCtx,
const ubyte *  payloadTypeOID,
intBoolean  detached,
RNGFun  rngFun,
void *  rngFunArg 
)

This function creates a CMS SignedData object. After you call this function, you must call other functions to populate to populate the object.

Note
To create a new CMS context structure, do not use this function, which creates a CMS SignedData object. Instead, use CMS_newContext().

To delete and free the SignedData object, call CMS_signedDeleteContext().

See also
CMS_signedAddCertificate()
CMS_signedAddCRL()
CMS_signedAddSigner()
CMS_signedAddSignerAttribute()
CMS_signedAddReceiptRequest()
CMS_signedUpdateContext()
CMS_signedDeleteContext()

(FIPS-compliance info in rngFun parameter desc)

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
pNewCtxOn return, pointer to the new SignedData object.
payloadTypeOIDPointer to an OID describing the data against which this SignedData object is a signature. The src/asn1/oiddefs.c file defines the valid constant arrays, such as pkcs7_data_OID. You can create a SignedData object for other types of payloads, such as pkcs7_encryptedData_OID. Refer to src/asn1/oiddefs.c for the arrays of OID types.
detachedTRUE if the SignedData object is a detached signature; otherwise FALSE.
rngFunPointer to a function that generates random numbers suitable for cryptographic use. To be FIPS-compliant, reference RANDOM_rngFun() (defined in random.c), and make sure that __ENABLE_MOCANA_FIPS_MODULE__ is defined in moptions.h
rngFunArgPointer to arguments that are required by the function referenced in rngFun. If you use RANDOM_rngFun(), you must supply a randomContext structure, which you can create by calling RANDOM_acquireContext().
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_signedUpdateContext()

MOC_EXTERN MSTATUS CMS_signedUpdateContext ( MOC_ASYM(hwAccelDescr hwAccelCtx) CMS_signedDataContext  myCtx,
const ubyte *  data,
ubyte4  dataLen,
ubyte **  ppOutput,
ubyte4 *  pOutputLen,
intBoolean  finished 
)

This function adds data to a CMS SignedData object.

Note
In streaming mode, output must be quick. As soon as all the data is in, call this function with the finished parameter equal to TRUE, which indicates that all the data is in and that the CMS can be generated in its entirety.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
myCtxPointer to the CMS SignedData object to which to add data.
dataPointer to the data to add.
dataLenLength of the data to add, data.
ppOutputOn return, if finished is TRUE, pointer to the address of the DER-encoded, signed CMS SignedData object.
pOutputLenOn return, if finished is TRUE, pointer to the length of the DER-encoded, signed CMS SignedData object, ppOutput.
finishedTRUE if this function supplies the last data to add; otherwise FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h

◆ CMS_updateContext()

MOC_EXTERN MSTATUS CMS_updateContext ( CMS_context  context,
const ubyte *  input,
ubyte4  inputLen,
ubyte **  ppOutput,
ubyte4 *  pOutputLen,
intBoolean *  pFinished 
)

This function adds data to a given CMS_context. The decrypted data (if any) is returned in newly allocated output buffers. If the logical end of the processing has been reached (that is, no more data is necessary), the returned value of pFinished is TRUE.

To enable this function, at least one of the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_PKCS7__
  • __ENABLE_MOCANA_CMS__

pkcs7.h, cms.h

Parameters
contextPointer to the CMS_context object to which to add data.
inputPointer to the data to add.
inputLenLength of the data to add, input.
ppOutputOn return, pointer to the address of a buffer containing the ASN.1 object to which the input contents were added.
pOutputLenOn return, pointer to the length of the ASN.1 object, pOutput.
pFinishedOn return, pointer TRUE if the ASN.1 object, pOutput, is complete; otherwise pointer to FALSE.
Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

cms.h