TrustCore SDK NanoCert API reference  version 7.0
pkcs.h
Go to the documentation of this file.
1 /*
2  * pkcs.h
3  *
4  * PKCS routines
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
23 #ifndef __PKCS_HEADER__
24 #define __PKCS_HEADER__
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 /*------------------------------------------------------------------*/
31 
32 /* exported routines */
33 
34 #ifdef __ENABLE_MOCANA_PKCS7__
35 
36 /* This API returns an DER encoded PKCS7 message that contains the
37 payload enveloped using the provided certificate. This is just a
38 high level wrapper, with less flexibility of PKCS7_EnvelopData */
39 MOC_EXTERN MSTATUS
40 PKCS7_EnvelopWithCertificate( const ubyte* cert, ubyte4 certLen,
41  const ubyte* encryptAlgoOID,
42  const ubyte* pPayLoad, ubyte4 payLoadLen,
43  ubyte** ppEnveloped, ubyte4* pEnvelopedLen);
44 
45 /* same but enveloped for several recipients described by their
46 certificate */
47 MOC_EXTERN MSTATUS
48 PKCS7_EnvelopWithCertificates( ubyte4 numCerts,
49  const ubyte* certs[/*numCerts*/],
50  ubyte4 certLens[/*numCerts*/],
51  const ubyte* encryptAlgoOID,
52  const ubyte* pPayLoad, ubyte4 payLoadLen,
53  ubyte** ppEnveloped, ubyte4* pEnvelopedLen);
54 
55 /* This API decrypts the Enveloped Data part of a PKCS7 message
56 This is a high level wrapper for PKCS7_DecryptEnvelopedData */
57 MOC_EXTERN MSTATUS
58 PKCS7_DecryptEnvelopedDataPart( const ubyte* pkcs7Msg, ubyte4 pkcs7MsgLen,
59  void* callbackArg,
60  PKCS7_GetPrivateKey getPrivateKeyFun,
61  ubyte** decryptedInfo, sbyte4* decryptedInfoLen);
62 
63 MOC_EXTERN MSTATUS
64 PKCS7_SignWithCertificateAndKeyBlob( const ubyte* cert, ubyte4 certLen,
65  const ubyte* keyBlob, ubyte4 keyBlobLen,
66  ASN1_ITEMPTR pCACertificates[/*numCACerts*/],
67  CStream pCAStreams[/*numCACerts*/],
68  sbyte4 numCACerts,
69  ASN1_ITEMPTR pCrls[/*numCrls*/],
70  CStream pCrlStreams[/*numCrls*/],
71  sbyte4 numCrls,
72  const ubyte* digestAlgoOID,
73  const ubyte* payLoadType,
74  ubyte* pPayLoad, /* removed const to get rid of compiler warning */
75  ubyte4 payLoadLen,
76  Attribute* pAuthAttrs, ubyte4 authAttrsLen,
77  RNGFun rngFun, void* rngFunArg,
78  ubyte** ppSigned, ubyte4* pSignedLen);
79 
80 #endif /*__ENABLE_MOCANA_PKCS7__ */
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 
87 #endif /*#ifndef __PKCS7_HEADER__ */
Information about an attribute of a SignedData object.
Definition: pkcs7.h:76
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)...
Definition: pkcs7.h:231