25 #ifndef __MOCANA_CMS_HEADER__ 26 #define __MOCANA_CMS_HEADER__ 40 E_MOC_CMS_ct_undetermined = 0,
41 E_MOC_CMS_ct_data = 1,
42 E_MOC_CMS_ct_signedData = 2,
43 E_MOC_CMS_ct_envelopedData = 3,
44 E_MOC_CMS_ct_signedAndEnvelopedData = 4,
45 E_MOC_CMS_ct_digestedData = 5,
46 E_MOC_CMS_ct_encryptedData = 6,
47 E_MOC_CMS_ct_authData = 102,
48 E_MOC_CMS_ct_invalid = 999,
56 E_MOC_CMS_ut_invalid = 0,
57 E_MOC_CMS_ut_update = 1,
58 E_MOC_CMS_ut_final = 2,
59 E_MOC_CMS_ut_result = 3,
67 E_MOC_CMS_sa_none = 0,
68 E_MOC_CMS_sa_addCert = 1,
77 #define MOC_CMS_signerID_ALL (-1) 94 ubyte4 serialNumberLen;
117 ubyte* pAlgoParameters;
118 ubyte4 algoParametersLen;
129 ubyte4 identifierLen;
171 MOC_CMS_KEKRecipientId kekrid;
172 MOC_CMS_PasswordRecipientId pwrdi;
173 MOC_CMS_OtherRecipientId orid;
188 ubyte* pMsgSigDigest;
189 ubyte4 msgSigDigestLen;
191 TimeDate* pSigningTime;
195 #define NO_TAG (0xFFFFFFFF) 217 ubyte* pSerialNumber,
218 ubyte4 serialNumberLen,
221 struct AsymmetricKey* pKey);
232 struct AsymmetricKey* pKey);
242 ubyte4 certificateLen,
253 ubyte* pSerialNumber,
254 ubyte4 serialNumberLen,
257 ubyte** ppCertificate,
258 ubyte4* pCertificateLen);
276 MOC_CMS_context pCtx,
281 typedef struct MOC_CMS_Callbacks
328 const void* callbackArg,
329 const MOC_CMS_Callbacks* pCallbacks);
370 intBoolean isStreaming,
371 const void *callbackArg,
394 intBoolean* pFinished);
480 MOC_CMS_Callbacks* pCB);
497 sbyte4* pNumRecipients);
551 sbyte4* pNumSigners);
626 const ubyte **ppCerts,
647 const ubyte **ppCRLs,
665 ubyte4* pNumDigests);
688 const ubyte** pDigestAlgoOID);
743 const AsymmetricKey* pKey,
744 const ubyte* pDigestAlgoOID,
745 ubyte4 digestAlgoOIDLen,
747 MOC_CMS_signerID *pSignID);
774 MOC_CMS_signerID signId,
780 intBoolean authenticated);
869 const ubyte* digestAlgoOID,
870 ubyte4 digestAlgoOIDLen);
894 const ubyte* encryptAlgoOID,
895 ubyte4 encryptAlgoOIDLen,
MSTATUS(* MOC_CMS_UpdateData)(const void *arg, MOC_CMS_context pCtx, MOC_CMS_UpdateType type, ubyte *pBuf, ubyte4 bufLen)
Callback type when the CMS engine has acquired payload data and intends to pass it on to user code...
Definition: moccms.h:275
MOC_EXTERN MSTATUS MOC_CMS_addDigest(MOC_CMS_context context, const ubyte *digestAlgoOID, ubyte4 digestAlgoOIDLen)
Add a digest to the CMS output context, should it not exits.
MOC_EXTERN MSTATUS MOC_CMS_setPayloadLength(MOC_CMS_context context, ubyte4 len)
Sets the pay load length for the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_finalizeContextOut(MOC_CMS_context context)
Finalize CMS output and flush all data.
MOC_EXTERN MSTATUS MOC_CMS_getCRLs(MOC_CMS_context context, const ubyte **ppCRLs, ubyte4 *pCRLsLen)
Return the CRLs inside the CMS data context.
The 'SubjectKeyIdentifier' of a certificate.
Definition: moccms.h:126
MOC_CMS_action
Action type when adding a certificate to the output CMS.
Definition: moccms.h:65
MOC_EXTERN MSTATUS MOC_CMS_deleteRecipientId(MOC_CMS_RecipientId *pRecipient)
Delete an instance of 'MOC_CMS_RecipientId'.
The general 'RecipientId' structure for all CMS recipient data.
Definition: moccms.h:163
MOC_EXTERN MSTATUS MOC_CMS_addUnprotectedAttribute(MOC_CMS_context context, const ubyte *idOID, ubyte4 oidLen, ubyte4 typeID, const ubyte *value, ubyte4 valueLen)
Add an attribute to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_getCallbacks(MOC_CMS_context context, MOC_CMS_Callbacks *pCB)
Return the values inside the callback structure.
MOC_EXTERN MSTATUS MOC_CMS_getCertificates(MOC_CMS_context context, const ubyte **ppCerts, ubyte4 *pCertLen)
Return the certificates inside the CMS data context.
MOC_EXTERN MSTATUS MOC_CMS_deleteSignerInfo(MOC_CMS_MsgSignInfo *pSigner)
Delete an instance of 'MOC_CMS_MsgSignInfo'.
MOC_EXTERN MSTATUS MOC_CMS_getNumSigners(MOC_CMS_context context, sbyte4 *pNumSigners)
Return the number of signers, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_addSigner(MOC_CMS_context context, ubyte *pCert, ubyte4 certLen, const AsymmetricKey *pKey, const ubyte *pDigestAlgoOID, ubyte4 digestAlgoOIDLen, MOC_CMS_action action, MOC_CMS_signerID *pSignID)
Add a 'signer' to the CMS output context.
void * MOC_CMS_context
Definition: moccms.h:204
The 'signer info' structure.
Definition: moccms.h:184
MOC_EXTERN MSTATUS MOC_CMS_updateContextOut(MOC_CMS_context context, const ubyte *output, ubyte4 outputLen, intBoolean last)
Add pay load data to the context for CMS output.
MOC_EXTERN MSTATUS MOC_CMS_getRecipientId(MOC_CMS_context context, sbyte4 idxRecipient, MOC_CMS_RecipientId *pRecipient)
Return the recipient id for 'idxRecipient' value, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_newContext(MOC_CMS_context *pNewContext, const void *callbackArg, const MOC_CMS_Callbacks *pCallbacks)
Create a new context to parse a CMS.
MSTATUS(* MOC_CMS_GetPrivateKeyEx)(const void *arg, const MOC_CMS_RecipientId *pRecipientId, struct AsymmetricKey *pKey)
Callback type when the CMS engine needs the private key data identified by the given MOC_CMS_Recipien...
Definition: moccms.h:230
The 'originatorKey' of a certificate, as defined in RFC-5652 for the 'KeyAgreeRecipientInfo' sequence...
Definition: moccms.h:113
MOC_EXTERN MSTATUS MOC_CMS_getSignerInfo(MOC_CMS_context context, sbyte4 idxSigner, MOC_CMS_MsgSignInfo *pSigner)
Return the signing info for 'idxSigner' value, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_addSignatureRaw(MOC_CMS_context context, const ubyte *pSig, ubyte4 sigLen)
Add a 'raw' signature to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_getNumSignatures(MOC_CMS_context context, sbyte4 *pNumSigs)
Return the number of signatures, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_addRecipient(MOC_CMS_context context, const ubyte *pCert, ubyte4 certLen)
Add a 'recipient' to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_getContentType(MOC_CMS_context context, MOC_CMS_ContentType *cmsContentType)
Return the value of type 'CMS_ContentType'.
The 'RecipientId' structure for the 'KeyTrans' type.
Definition: moccms.h:135
The 'issuer' and 'serial number' of a certificate.
Definition: moccms.h:89
MSTATUS(* MOC_CMS_ValidateRootCertificate)(const void *arg, ubyte *pCertificate, ubyte4 certificateLen, MOC_CMS_MsgSignInfo *pSigInfo)
Callback type when the CMS engine needs to validate a certificate with the user.
Definition: moccms.h:240
MOC_EXTERN MSTATUS MOC_CMS_deleteContext(MOC_CMS_context *pContext)
Delete the context.
MOC_EXTERN MSTATUS MOC_CMS_getDigestID(MOC_CMS_context context, ubyte4 idx, const ubyte **pDigestAlgoOID)
Return the OID value for a digest, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_newContextOut(MOC_CMS_context *pNewContext, MOC_CMS_ContentType type, RNGFun rngFun, void *rngFunArg, intBoolean isStreaming, const void *callbackArg, MOC_CMS_UpdateData dataUpdateFun)
Create a new context to output data in a CMS format.
MOC_CMS_ContentType
Content type of a received or created CMS.
Definition: moccms.h:38
The 'RecipientId' structure for the 'KeyAgree' type.
Definition: moccms.h:148
MOC_EXTERN MSTATUS MOC_CMS_addCertificate(MOC_CMS_context context, ubyte *pCert, ubyte4 certLen)
Add a certificate to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_getNumDigests(MOC_CMS_context context, ubyte4 *pNumDigests)
Return the number of digests, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_getNumRecipients(MOC_CMS_context context, sbyte4 *pNumRecipients)
Return the number of recipients, if applicable.
MOC_EXTERN MSTATUS MOC_CMS_addCRL(MOC_CMS_context context, ubyte *pCRL, ubyte4 CRLLen)
Add a certificate revocation list to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_addSignerAttribute(MOC_CMS_context context, MOC_CMS_signerID signId, const ubyte *idOID, ubyte4 oidLen, ubyte4 typeID, const ubyte *value, ubyte4 valueLen, intBoolean authenticated)
Add an attribute to the CMS output context.
MOC_EXTERN MSTATUS MOC_CMS_setEncryption(MOC_CMS_context context, const ubyte *encryptAlgoOID, ubyte4 encryptAlgoOIDLen, RNGFun rngFun, void *rngFunArg)
Sets the encryption algorithm for the CMS output context.
sbyte4 MOC_CMS_signerID
The type for a signer's ID value.
Definition: moccms.h:74
MOC_CMS_UpdateType
Payload update type.
Definition: moccms.h:54
MSTATUS(* MOC_CMS_GetPrivateKey)(const void *arg, ubyte *pSerialNumber, ubyte4 serialNumberLen, ubyte *pIssuer, ubyte4 issuerLen, struct AsymmetricKey *pKey)
Callback type when the CMS engine needs the private key data identified by the given serial number an...
Definition: moccms.h:216
MOC_EXTERN MSTATUS MOC_CMS_updateContext(MOC_CMS_context context, const ubyte *input, ubyte4 inputLen, intBoolean *pFinished)
Add CMS message data to the context.
MSTATUS(* MOC_CMS_GetCertificate)(const void *arg, ubyte *pSerialNumber, ubyte4 serialNumberLen, ubyte *pIssuer, ubyte4 issuerLen, ubyte **ppCertificate, ubyte4 *pCertificateLen)
Callback type when the CMS engine needs the public certificate data identified by the given serial nu...
Definition: moccms.h:252