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

Header file for SoT Platform PKCS #7 convenience API. More...

Go to the source code of this file.

Data Structures

struct  Attribute
 Information about an attribute of a SignedData object. More...
 
struct  PKCS7_Callbacks
 Pointers to PKCS #7 callback functions required by PKCS #12 functions. More...
 
struct  signerInfoPtr
 Information about a SignedData object's signer. More...
 

Macros

#define PKCS7_EXTERNAL_SIGNATURES   0x01
 

Typedefs

typedef MSTATUS(* PKCS7_GetCertificate) (const void *arg, CStream cs, struct ASN1_ITEM *pSerialNumber, struct ASN1_ITEM *pIssuerName, ubyte **ppCertificate, ubyte4 *certificateLen)
 Get a certificate for a given issuer name and serial number. More...
 
typedef MSTATUS(* PKCS7_GetPrivateKey) (const void *arg, CStream cs, struct ASN1_ITEM *pSerialNumber, struct ASN1_ITEM *pIssuerName, struct AsymmetricKey *pKey)
 Get the private key associated with a given certificate in a PKCS #7 message (CMS message stream). More...
 
typedef MSTATUS(* PKCS7_ValidateRootCertificate) (const void *arg, CStream cs, struct ASN1_ITEM *pCertificate, sbyte4 chainLength)
 Validate the certificates in a PKCS #7 message. More...
 

Enumerations

enum  CMCStatus {
  success = 0, failed = 2, pending = 3, noSupport = 4,
  confirmRequired = 5, popRequired = 6, partial = 7
}
 

Functions

MOC_EXTERN MSTATUS CMC_createPKIData (ASN1_ITEMPTR pControlItem, CStream *controlStream, ASN1_ITEMPTR pReqItem, CStream *reqStream, ubyte **ppBuffer, ubyte4 *pBufferLen)
 
MOC_EXTERN MSTATUS CMC_createPKIDataEx (taggedAttribute pTaggedAttributes[], ubyte4 numTaggedAttrs, ubyte *pDerCertificateRequest, ubyte4 derCertificateReqLen, taggedContentInfo pTaggedContentInfos[], ubyte4 numTaggedContents, otherMsg pOtherMsgs[], ubyte4 numOtherMsgs, ubyte **ppBuffer, ubyte4 *pBufferLen)
 
MOC_EXTERN MSTATUS CMC_getPKIData (ASN1_ITEM *pRootItem, CStream stream, ASN1_ITEM **ppPkiRequest)
 
MOC_EXTERN MSTATUS CMC_getPKIResponse (ASN1_ITEM *pRootItem, CStream stream, ASN1_ITEM **ppPkiResponse)
 
MOC_EXTERN MSTATUS CMC_processCmsSequence (ASN1_ITEM *pPKIInputData, CStream stream, ubyte4 *pBodyPartsList, ubyte4 numBodyParts, byteBoolean isResponseData, ASN1_ITEMPTR **ppEnvelopDataItems, ubyte4 *pNumEnvelopDataItems)
 
MOC_EXTERN MSTATUS CMC_processControlSequence (ASN1_ITEM *pPKIInputData, CStream stream, ubyte *pBatchOID, ubyte4 **ppBodyPartIds, ubyte4 *pNumBodyPartIds)
 
MOC_EXTERN MSTATUS CMC_processOtherMsgSequence (ASN1_ITEM *pPKIInputData, CStream stream, ubyte **ppOutData, ubyte4 *pOutDataLen, byteBoolean isResponseData)
 
MOC_EXTERN MSTATUS CMC_SignData (MOC_ASYM(hwAccelDescr hwAccelCtx) ubyte4 flags, struct DER_ITEM *pStart, struct DER_ITEM *pParent, struct ASN1_ITEM *pCACertificatesParseRoots[], CStream pCAStreams[], sbyte4 numCACerts, struct ASN1_ITEM *pCrlsParseRoots[], CStream pCrlStreams[], sbyte4 numCrls, cmcSignerInfoPtr *pCmcSignerInfos, ubyte4 numSigners, const ubyte *payLoadType, const ubyte *pPayLoad, ubyte4 payLoadLen, RNGFun rngFun, void *rngFunArg, ubyte **ppSigned, ubyte4 *pSignedLen)
 Create a DER-encoded, version 1, ASN.1 SignedData object for data internal or external to the SignedData object. More...
 
MOC_EXTERN MSTATUS CMC_verifyAttestationReqType (ASN1_ITEM *pPKIInputData, CStream stream, byteBoolean *pAttestFlow, ubyte **ppOid)
 
MOC_EXTERN MSTATUS PKCS7_DecryptEnvelopedData (MOC_HW(hwAccelDescr hwAccelCtx) struct ASN1_ITEM *pEnvelopedData, CStream s, const void *callbackArg, PKCS7_GetPrivateKey getPrivateKeyFun, ubyte **decryptedInfo, sbyte4 *decryptedInfoLen)
 Extract and decrypt the encrypted content of an EnvelopedData object. More...
 
MOC_EXTERN MSTATUS PKCS7_DecryptEnvelopedDataAux (MOC_HW(hwAccelDescr hwAccelCtx) struct ASN1_ITEM *pEnvelopedData, CStream s, const void *callbackArg, PKCS7_GetPrivateKey getPrivateKeyFun, enum encryptedContentType *pType, struct ASN1_ITEM **ppEncryptedContent, BulkCtx *ppBulkCtx, const BulkEncryptionAlgo **ppBulkAlgo, ubyte iv[])
 Decrypt an EnvelopedData object and get its encryption details. More...
 
MOC_EXTERN MSTATUS PKCS7_DigestData (MOC_HASH(hwAccelDescr hwAccelCtx) struct DER_ITEM *pStart, struct DER_ITEM *pParent, const ubyte *payLoadType, ubyte hashType, const ubyte *pPayLoad, ubyte4 payLoadLen, ubyte **ppDigested, ubyte4 *pDigestedLen)
 Create a DER-encoded, ASN.1 DigestedData object for the given data. More...
 
MOC_EXTERN MSTATUS PKCS7_EnvelopData (MOC_HW(hwAccelDescr hwAccelCtx) struct DER_ITEM *pStart, struct DER_ITEM *pParent, struct ASN1_ITEM *pCACertificatesParseRoots[], CStream pStreams[], sbyte4 numCACerts, const ubyte *encryptAlgoOID, RNGFun rngFun, void *rngFunArg, const ubyte *pPayLoad, ubyte4 payLoadLen, ubyte **ppEnveloped, ubyte4 *pEnvelopedLen)
 Create a DER-encoded, version 0, ASN.1 EnvelopedData object containing a given payload. More...
 
MOC_EXTERN MSTATUS PKCS7_EnvelopDataWoaep (MOC_HW(hwAccelDescr hwAccelCtx) struct DER_ITEM *pStart, struct DER_ITEM *pParent, struct ASN1_ITEM *pCACertificatesParseRoots[], CStream pStreams[], sbyte4 numCACerts, const ubyte *encryptAlgoOID, RNGFun rngFun, void *rngFunArg, ubyte isOaep, ubyte4 oaepHashAlgo, sbyte *pOaepLabel, const ubyte *pPayLoad, ubyte4 payLoadLen, ubyte **ppEnveloped, ubyte4 *pEnvelopedLen)
 Create a DER-encoded, version 0, ASN.1 EnvelopedData object containing a given payload. More...
 
MOC_EXTERN MSTATUS PKCS7_GetCertificates (struct ASN1_ITEM *pRootItem, CStream s, struct ASN1_ITEM **ppFirstCertificate)
 If a given CStream contains a PKCS #7 SignedData object, get the first certificate. More...
 
MOC_EXTERN MSTATUS PKCS7_GetSignerDigestAlgo (struct ASN1_ITEM *pSignerInfo, CStream cs, ubyte *hashAlgoId)
 Get a SignerInfo object's digest hash function identifier. More...
 
MOC_EXTERN MSTATUS PKCS7_GetSignerSignatureAlgo (struct ASN1_ITEM *pSignerInfo, CStream cs, ubyte *pubKeyAlgoId)
 Get a SignerInfo object's digest encryption algorithm identifier. More...
 
MOC_EXTERN MSTATUS PKCS7_GetSignerSignedAttributes (struct ASN1_ITEM *pSignerInfo, struct ASN1_ITEM **ppFirstSignedAttribute)
 Get the first signed attribute in a DER-encoded, ASN.1 SignerInfo object. More...
 
MOC_EXTERN MSTATUS PKCS7_GetSignerUnsignedAttributes (struct ASN1_ITEM *pSignerInfo, struct ASN1_ITEM **ppFirstUnsignedAttribute)
 Get the first unsigned attribute in a DER-encoded, ASN.1 SignerInfo object. More...
 
MOC_EXTERN MSTATUS PKCS7_SignData (MOC_ASYM(hwAccelDescr hwAccelCtx) ubyte4 flags, struct DER_ITEM *pStart, struct DER_ITEM *pParent, struct ASN1_ITEM *pCACertificatesParseRoots[], CStream pCAStreams[], sbyte4 numCACerts, struct ASN1_ITEM *pCrlsParseRoots[], CStream pCrlStreams[], sbyte4 numCrls, signerInfoPtr *pSignerInfos, ubyte4 numSigners, const ubyte *payLoadType, const ubyte *pPayLoad, ubyte4 payLoadLen, RNGFun rngFun, void *rngFunArg, ubyte **ppSigned, ubyte4 *pSignedLen)
 Create a DER-encoded, version 1, ASN.1 SignedData object for data internal or external to the SignedData object. More...
 
MOC_EXTERN MSTATUS PKCS7_VerifySignedData (MOC_ASYM(hwAccelDescr hwAccelCtx) struct ASN1_ITEM *pSignedData, CStream s, const void *callbackArg, PKCS7_GetCertificate getCertFun, PKCS7_ValidateRootCertificate valCertFun, const ubyte *payLoad, ubyte4 payLoadLen, sbyte4 *numKnownSigners)
 Verify the signature of a SignedData object that contains the signed data. More...
 

Detailed Description

Header file for SoT Platform PKCS #7 convenience API.