TrustCore SDK NanoCert API reference  version 7.0
asn1cert.h
Go to the documentation of this file.
1 /*
2  * asn1cert.h
3  *
4  * ASN.1 Certificate Encoding Header
5  *
6  * Copyright 2019-2024 DigiCert, Inc. All Rights Reserved.
7  * Proprietary and Confidential Material.
8  *
9  */
10 
20 /*------------------------------------------------------------------*/
21 
22 #ifndef __ASN1CERT_HEADER__
23 #define __ASN1CERT_HEADER__
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
62 MOC_EXTERN MSTATUS ASN1CERT_generateCertificateEx(MOC_ASYM(hwAccelDescr hwAccelCtx)
63  const AsymmetricKey *pCertKey,
64  const certDistinguishedName *pSubjectInfo,
65  const AsymmetricKey *pSignKey,
66  const ASN1_ITEM *pIssuerInfo,
67  CStream cs,
68  const ubyte* serialNumber,
69  ubyte4 serialNumberLen,
70  ubyte signAlgo,
71  const certExtensions* pExtensions,
72  RNGFun rngFun, void* rngFunArg,
73  ubyte **ppRetCertificate,
74  ubyte4 *pRetCertLength);
75 
103 MOC_EXTERN MSTATUS ASN1CERT_generateSelfSignedCertificate(MOC_ASYM(hwAccelDescr hwAccelCtx) AsymmetricKey *pCertKey,
104  const certDistinguishedName *pSubjectInfo,
105  ubyte signAlgo,
106  const certExtensions* pExtensions,
107  RNGFun rngFun,
108  void* rngFunArg,
109  ubyte **ppRetCertificate,
110  ubyte4 *pRetCertLength);
111 
142 MOC_EXTERN MSTATUS ASN1CERT_generateCertificate(MOC_ASYM(hwAccelDescr hwAccelCtx) AsymmetricKey *pCertKey,
143  const certDistinguishedName *pSubjectInfo,
144  const AsymmetricKey *pSignKey,
145  const ASN1_ITEM *pIssuerInfo,
146  CStream cs, ubyte signAlgo,
147  const certExtensions* pExtensions,
148  RNGFun rngFun, void* rngFunArg,
149  ubyte **ppRetCertificate,
150  ubyte4 *pRetCertLength);
151 
152 /* used by PKCS 10 */
153 
171 MOC_EXTERN MSTATUS ASN1CERT_StoreDistinguishedName( DER_ITEMPTR pRoot,
172  const certDistinguishedName* pCertInfo);
173 
190 MOC_EXTERN MSTATUS ASN1CERT_storePublicKeyInfo(MOC_ASYM(hwAccelDescr hwAccelCtx) const AsymmetricKey* pPublicKey, DER_ITEMPTR pCertificate);
191 
216 MOC_EXTERN MSTATUS ASN1CERT_Sign(MOC_ASYM(hwAccelDescr hwAccelCtx)
217  DER_ITEMPTR pSignedHead, const AsymmetricKey* pSignKey, ubyte signAlgo,
218  RNGFun rngFun, void* rngFunArg, ubyte **ppRetDEREncoding, ubyte4 *pRetDEREncodingLen);
219 
238 MOC_EXTERN MSTATUS ASN1CERT_AddExtensions(DER_ITEMPTR pExtensionTag, const certExtensions* pExtensions,
239  DER_ITEMPTR *ppExtsItem);
240 
241 #if (defined(__ENABLE_MOCANA_ECC__))
242 
259 MOC_EXTERN MSTATUS ASN1CERT_storeECCPublicKeyInfo( MOC_ECC(hwAccelDescr hwAccelCtx) const ECCKey *pECCKey, DER_ITEMPTR pCertificate);
260 #endif
261 
262 #ifdef __cplusplus
263 }
264 #endif
265 
266 #endif /* __ASN1CERT_HEADER__ */
267 
MOC_EXTERN MSTATUS ASN1CERT_Sign(MOC_ASYM(hwAccelDescr hwAccelCtx) DER_ITEMPTR pSignedHead, const AsymmetricKey *pSignKey, ubyte signAlgo, RNGFun rngFun, void *rngFunArg, ubyte **ppRetDEREncoding, ubyte4 *pRetDEREncodingLen)
Signs a certificate with a given asymmetric key.
MOC_EXTERN MSTATUS ASN1CERT_generateSelfSignedCertificate(MOC_ASYM(hwAccelDescr hwAccelCtx) AsymmetricKey *pCertKey, const certDistinguishedName *pSubjectInfo, ubyte signAlgo, const certExtensions *pExtensions, RNGFun rngFun, void *rngFunArg, ubyte **ppRetCertificate, ubyte4 *pRetCertLength)
Generate a self-signed certificate with the given key, name, and extensions.
MOC_EXTERN MSTATUS ASN1CERT_StoreDistinguishedName(DER_ITEMPTR pRoot, const certDistinguishedName *pCertInfo)
Writes the distinguished name components to a certificate in the process of being generated...
MOC_EXTERN MSTATUS ASN1CERT_generateCertificateEx(MOC_ASYM(hwAccelDescr hwAccelCtx) const AsymmetricKey *pCertKey, const certDistinguishedName *pSubjectInfo, const AsymmetricKey *pSignKey, const ASN1_ITEM *pIssuerInfo, CStream cs, const ubyte *serialNumber, ubyte4 serialNumberLen, ubyte signAlgo, const certExtensions *pExtensions, RNGFun rngFun, void *rngFunArg, ubyte **ppRetCertificate, ubyte4 *pRetCertLength)
Generate a certificate with the given input key, signing key, name, issuer, and extensions.
Distinguished name data (names and start/end dates) to support certificate generation.
Definition: ca_mgmt.h:424
Container for a certificate's version 3 extensions.
Definition: ca_mgmt.h:560
MOC_EXTERN MSTATUS ASN1CERT_storePublicKeyInfo(MOC_ASYM(hwAccelDescr hwAccelCtx) const AsymmetricKey *pPublicKey, DER_ITEMPTR pCertificate)
Writes the public key information to a certificate in the process of being generated.
MOC_EXTERN MSTATUS ASN1CERT_generateCertificate(MOC_ASYM(hwAccelDescr hwAccelCtx) AsymmetricKey *pCertKey, const certDistinguishedName *pSubjectInfo, const AsymmetricKey *pSignKey, const ASN1_ITEM *pIssuerInfo, CStream cs, ubyte signAlgo, const certExtensions *pExtensions, RNGFun rngFun, void *rngFunArg, ubyte **ppRetCertificate, ubyte4 *pRetCertLength)
Generate a certificate with the given input key, signing key, name, issuer, and extensions.
MOC_EXTERN MSTATUS ASN1CERT_AddExtensions(DER_ITEMPTR pExtensionTag, const certExtensions *pExtensions, DER_ITEMPTR *ppExtsItem)
Writes the extensions to a certificate in the process of being generated.