38 #ifndef __CA_MGMT_HEADER__ 39 #define __CA_MGMT_HEADER__ 70 akt_tap_rsa = 0x00020001,
71 akt_tap_ecc = 0x00020002,
72 akt_hsm_rsa = 0x00010001,
73 akt_hsm_ecc = 0x00010002
76 #if (defined(__ENABLE_MOCANA_ECC__)) 96 #if (defined(__ENABLE_MOCANA_QS__)) 100 cid_QS_SIG_DILITHIUM_2 = 0x04,
101 cid_QS_SIG_DILITHIUM_3 = 0x05,
102 cid_QS_SIG_DILITHIUM_4 = 0x06,
103 cid_QS_SIG_DILITHIUM_5 = 0x07,
104 cid_QS_SIG_FALCON_512 = 0x10,
105 cid_QS_SIG_FALCON_1024 = 0x11,
106 cid_QS_SIG_SPHINCS_PLUS_SHA2_128S = 0x50,
107 cid_QS_SIG_SPHINCS_PLUS_SHA2_128F = 0x51,
108 cid_QS_SIG_SPHINCS_PLUS_SHAKE_128S = 0x52,
109 cid_QS_SIG_SPHINCS_PLUS_SHAKE_128F = 0x53,
110 cid_QS_SIG_SPHINCS_PLUS_SHA2_192S = 0x54,
111 cid_QS_SIG_SPHINCS_PLUS_SHA2_192F = 0x55,
112 cid_QS_SIG_SPHINCS_PLUS_SHAKE_192S = 0x56,
113 cid_QS_SIG_SPHINCS_PLUS_SHAKE_192F = 0x57,
114 cid_QS_SIG_SPHINCS_PLUS_SHA2_256S = 0x58,
115 cid_QS_SIG_SPHINCS_PLUS_SHA2_256F = 0x59,
116 cid_QS_SIG_SPHINCS_PLUS_SHAKE_256S = 0x5a,
117 cid_QS_SIG_SPHINCS_PLUS_SHAKE_256F = 0x5b,
119 cid_QS_SIG_RAINBOW_IA_CLASSIC = 0x20,
120 cid_QS_SIG_RAINBOW_IA_CYCLIC = 0x21,
121 cid_QS_SIG_RAINBOW_IA_CYCLIC_COMPRESSED = 0x22,
122 cid_QS_SIG_RAINBOW_IIIC_CLASSIC = 0x23,
123 cid_QS_SIG_RAINBOW_IIIC_CYCLIC = 0x24,
124 cid_QS_SIG_RAINBOW_IIIC_CYCLIC_COMPRESSED = 0x25,
125 cid_QS_SIG_RAINBOW_VC_CLASSIC = 0x26,
126 cid_QS_SIG_RAINBOW_VC_CYCLIC = 0x27,
127 cid_QS_SIG_RAINBOW_VC_CYCLIC_COMPRESSED = 0x28,
128 cid_QS_SIG_QTESLA_P_I = 0x30,
129 cid_QS_SIG_MQDSS_31_48 = 0x40,
131 cid_QS_KEM_MCELIECE_348864 = 0x100,
132 cid_QS_KEM_MCELIECE_348864F = 0x101,
133 cid_QS_KEM_MCELIECE_460896 = 0x102,
134 cid_QS_KEM_MCELIECE_460896F = 0x103,
135 cid_QS_KEM_MCELIECE_6688128 = 0x104,
136 cid_QS_KEM_MCELIECE_6688128F = 0x105,
137 cid_QS_KEM_MCELIECE_6960119 = 0x106,
138 cid_QS_KEM_MCELIECE_6960119F = 0x107,
139 cid_QS_KEM_MCELIECE_8192128 = 0x108,
140 cid_QS_KEM_MCELIECE_8192128F = 0x109,
141 cid_QS_KEM_KYBER_512 = 0x110,
142 cid_QS_KEM_KYBER_768 = 0x111,
143 cid_QS_KEM_KYBER_1024 = 0x112,
144 cid_QS_KEM_KYBER_512_90S = 0x113,
145 cid_QS_KEM_KYBER_768_90S = 0x114,
146 cid_QS_KEM_KYBER_1024_90S = 0x115,
147 cid_QS_KEM_NTRU_HPS_2048_509 = 0x120,
148 cid_QS_KEM_NTRU_HPS_2048_677 = 0x121,
149 cid_QS_KEM_NTRU_HPS_4096_821 = 0x122,
150 cid_QS_KEM_NTRU_HRSS_701 = 0x123,
151 cid_QS_KEM_LIGHTSABER = 0x130,
152 cid_QS_KEM_SABER = 0x131,
153 cid_QS_KEM_FIRESABER = 0x132,
154 cid_QS_KEM_FRODOKEM_640_AES = 0x140,
155 cid_QS_KEM_NEWHOPE_512CCA = 0x150,
156 cid_QS_KEM_SIKE_P434 = 0x160,
157 cid_QS_KEM_SIDH_P434 = 0x170
164 struct AsymmetricKey;
215 #if !(defined __ENABLE_MOCANA_64_BIT__) 634 matchFlagSuffix = 0x01,
635 noWildcardMatch = 0x02,
636 matchFlagNoWildcard = 0x02,
637 matchFlagDotSuffix = 0x04
655 SubjectAltName_otherName,
656 SubjectAltName_rfc822Name,
657 SubjectAltName_dNSName,
658 SubjectAltName_x400Address,
659 SubjectAltName_directoryName,
660 SubjectAltName_ediPartyName,
661 SubjectAltName_uniformResourceIdentifier,
662 SubjectAltName_iPAddress,
663 SubjectAltName_registeredID
673 typedef struct SubjectAltNameAttr
675 Blob subjectAltNameValue;
676 ubyte subjectAltNameType;
677 } SubjectAltNameAttr;
691 typedef struct CertProperties
694 ubyte keyPropertyType;
698 const struct AsymmetricKey*
pKey;
712 MOC_EXTERN sbyte4 CA_MGMT_generateCertificateEx(
certDescriptor *pRetCertificate, ubyte4 keySize,
717 MOC_EXTERN sbyte4 CA_MGMT_generateCertificateWithProperties(
certDescriptor *pRetCertificate,
719 const CertProperties* properties);
721 MOC_EXTERN sbyte4 CA_MGMT_generateCertificateEx2(
certDescriptor *pRetCertificate,
722 struct AsymmetricKey* key,
724 ubyte signAlgorithm);
866 MOC_EXTERN sbyte4 CA_MGMT_makeSubjectAltNameExtension(
extensions* pExtension,
867 const SubjectAltNameAttr* nameAttrs,
868 sbyte4 numNameAttrs);
953 MOC_EXTERN sbyte4 CA_MGMT_returnPublicKey(
certDescriptor *pCertificateDescr, ubyte **ppRetPublicKey, ubyte4 *pRetPublicKeyLength);
989 MOC_EXTERN sbyte4 CA_MGMT_returnPublicKeyBitLength(
certDescriptor *pCertificateDescr, ubyte4 *pRetPublicKeyLengthInBits);
1023 MOC_EXTERN sbyte4 CA_MGMT_freePublicKey(ubyte **ppRetPublicKey);
1263 sbyte4 isSubject, sbyte4 includeASN1SeqHeader, ubyte4* pASN1NameOffset, ubyte4* pASN1NameLen);
1270 MOC_EXTERN sbyte4
CA_MGMT_convertKeyDER(ubyte *pDerRsaKey, ubyte4 derRsaKeyLength, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength);
1276 MOC_EXTERN sbyte4
CA_MGMT_convertKeyPEM(ubyte *pPemRsaKey, ubyte4 pemRsaKeyLength, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength);
1289 ubyte **ppRetKeyDER, ubyte4 *pRetKeyDERLength);
1295 MOC_EXTERN MSTATUS
CA_MGMT_keyBlobToPEM(
const ubyte *pKeyBlob, ubyte4 keyBlobLength, ubyte **ppRetKeyPEM, ubyte4 *pRetKeyPEMLength);
1350 ubyte4 derRsaKeyLength,
1351 ubyte **ppRetKeyBlob,
1352 ubyte4 *pRetKeyBlobLength
1370 MOC_EXTERN MSTATUS CA_MGMT_tpm12RsaKeyBlobToDer (
1373 struct vlong *pModulus,
1374 struct vlong *pPubExpo,
1375 ubyte **ppDerEncoding,
1376 ubyte4 *pDerEncodingLen
1523 MOC_EXTERN sbyte4
CA_MGMT_decodeCertificate(ubyte* pKeyFile, ubyte4 fileSize, ubyte** ppDecodeFile, ubyte4 *pDecodedLength);
1525 #ifdef __ENABLE_MOCANA_CERTIFICATE_SEARCH_SUPPORT__ 1526 MOC_EXTERN sbyte4 CA_MGMT_extractSerialNum (ubyte* pCertificate, ubyte4 certificateLength, ubyte** ppRetSerialNum, ubyte4* pRetSerialNumLength);
1527 MOC_EXTERN sbyte4 CA_MGMT_freeSearchDetails(ubyte** ppFreeData);
1533 typedef sbyte4 (*CA_MGMT_EnumItemCBFun)(
const ubyte* pContent, ubyte4 contentLen, ubyte4 contentType,
1534 ubyte4 index,
void* userArg);
1598 MOC_EXTERN sbyte4 CA_MGMT_enumCrl(ubyte* pCertificate, ubyte4 certificateLength,
1599 CA_MGMT_EnumItemCBFun callbackFunc,
void* userArg);
1666 MOC_EXTERN sbyte4 CA_MGMT_enumAltName( ubyte* pCertificate, ubyte4 certificateLength, sbyte4 isSubject,
1667 CA_MGMT_EnumItemCBFun callbackFunc,
void* userArg);
1670 #ifdef __PUBCRYPTO_HEADER__ 1676 MOC_EXTERN MSTATUS CA_MGMT_makeKeyBlobEx(
const AsymmetricKey *
pKey, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyLength);
1682 MOC_EXTERN MSTATUS CA_MGMT_extractKeyBlobEx(
const ubyte *pKeyBlob, ubyte4 keyBlobLength, AsymmetricKey* pKey);
1688 MOC_EXTERN MSTATUS CA_MGMT_extractKeyBlobTypeEx(
const ubyte *pKeyBlob, ubyte4 keyBlobLength, ubyte4 *pRetKeyType);
1694 MOC_EXTERN MSTATUS CA_MGMT_extractPublicKey(
const ubyte *pKeyBlob, ubyte4 keyBlobLength, ubyte **ppRetPublicKeyBlob, ubyte4 *pRetPublicKeyBlobLength, ubyte4 *pRetKeyType);
1697 #ifdef __ENABLE_MOCANA_EXTRACT_CERT_BLOB__ 1698 MOC_EXTERN sbyte4 CA_MGMT_findCertDistinguishedName(ubyte *pCertificate, ubyte4 certificateLength, intBoolean isSubject, ubyte **ppRetDistinguishedName, ubyte4 *pRetDistinguishedNameLen);
1741 MOC_EXTERN sbyte4
CA_MGMT_generateNakedKey(ubyte4 keyType, ubyte4 keySize, ubyte **ppRetNewKeyBlob, ubyte4 *pRetNewKeyBlobLength);
1816 ubyte **ppRetNewKeyBlob, ubyte4 *pRetNewKeyBlobLength);
1936 #ifdef __PKCS_KEY_HEADER__ 1981 MOC_EXTERN sbyte4 CA_MGMT_convertKeyBlobToPKCS8Key(
const ubyte *pKeyBlob, ubyte4 keyBlobLength,
enum PKCS8EncryptionType encType,
const ubyte *pPassword, ubyte4 passwordLen, ubyte **ppRetPKCS8DER, ubyte4 *pRetPkcs8DERLen);
1984 #if !(defined(__DISABLE_MOCANA_KEY_GENERATION__)) && !(defined(__DISABLE_MOCANA_CERTIFICATE_PARSING__)) 2001 MOC_EXTERN sbyte4
CA_MGMT_extractPublicKeyInfo(ubyte *pCertificate, ubyte4 certificateLen, ubyte** ppRetKeyBlob, ubyte4 *pRetKeyBlobLen);
2017 MOC_EXTERN sbyte4
CA_MGMT_verifySignature(
const ubyte* pIssuerCertBlob, ubyte4 issuerCertBlobLen, ubyte* pCertificate, ubyte4 certLen);
2034 MOC_EXTERN sbyte4
CA_MGMT_extractSignature(ubyte* pCertificate, ubyte4 certificateLen, ubyte** ppSignature, ubyte4* pSignatureLen);
2061 MOC_EXTERN MSTATUS
CA_MGMT_getCertSignAlgoType(ubyte *pCertificate, ubyte4 certificateLen, ubyte4* pHashType, ubyte4* pPubKeyType);
ubyte4 valueLen
Number of bytes in the name value buffer (value).
Definition: ca_mgmt.h:332
ubyte4 cookie
Application-specific cookie.
Definition: ca_mgmt.h:226
MOC_EXTERN MSTATUS CA_MGMT_getCertSignAlgoType(ubyte *pCertificate, ubyte4 certificateLen, ubyte4 *pHashType, ubyte4 *pPubKeyType)
Gets the hash type and public key type out of a cert.
MOC_EXTERN sbyte4 CA_MGMT_verifySignature(const ubyte *pIssuerCertBlob, ubyte4 issuerCertBlobLen, ubyte *pCertificate, ubyte4 certLen)
Verifies the signature in a certificate.
Container for nameAttr structure information required to construct an ASN.1 RelativeDistinguishedName...
Definition: ca_mgmt.h:396
sbyte * pStartDate
String identifying certificate's start date, in the format yymmddhhmmssZ; for example, "030526000126Z" specifies May 26th, 2003 12:01:26 AM.
Definition: ca_mgmt.h:448
ubyte4 dnCount
Number of relative distinguished names in pDistinguishedName buffer.
Definition: ca_mgmt.h:437
MOC_EXTERN sbyte4 CA_MGMT_extractCertDistinguishedName(ubyte *pCertificate, ubyte4 certificateLength, sbyte4 isSubject, certDistinguishedName *pRetDN)
Get a DER-encoded X.509 certificate's subject or issuer (as specified by the isSubject parameter) dis...
ubyte4 otherExtCount
Number of extensions in the extensions array.
Definition: ca_mgmt.h:629
Version 3 certificate or CRL extension (as defined in RFC 3280).
Definition: ca_mgmt.h:473
MOC_EXTERN sbyte4 CA_MGMT_generateCertificateHybrid(certDescriptor *pRetCertificate, ubyte4 curve, ubyte4 qsAlg, const certDistinguishedName *pCertInfo, const certExtensions *pExtensions, const certDescriptor *pParentCertificate)
Generates a signed X.509 certificate and private/public key pair for a hybrid authentication algorith...
ubyte2 keyUsage
Bit-string representing the desired version 3 certificate extensions.
Definition: ca_mgmt.h:617
MOC_EXTERN sbyte4 CA_MGMT_convertKeyPEM(ubyte *pPemRsaKey, ubyte4 pemRsaKeyLength, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength)
This is an old function.
MOC_EXTERN sbyte4 CA_MGMT_convertKeyDER(ubyte *pDerRsaKey, ubyte4 derRsaKeyLength, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength)
This is an old function.
ubyte4 valueLen
Number of bytes in the DER-encoded extension value (value).
Definition: ca_mgmt.h:547
relativeDN * pDistinguishedName
Pointer to buffer array of relative distinguished names.
Definition: ca_mgmt.h:430
MOC_EXTERN sbyte4 CA_MGMT_extractCertTimes(ubyte *pCertificate, ubyte4 certificateLength, certDistinguishedName *pRetDN)
Get a DER-encoded X.509 certificate's start and expiration times and dates.
MOC_EXTERN sbyte4 CA_MGMT_extractSignature(ubyte *pCertificate, ubyte4 certificateLen, ubyte **ppSignature, ubyte4 *pSignatureLen)
Gets the signature out of a cert.
sbyte * pEndDate
String identifying certificate's end date, in the format yymmddhhmmssZ; for example, "330524230347Z" specifies May 24th, 2033 11:03:47 PM.
Definition: ca_mgmt.h:459
MOC_EXTERN sbyte4 CA_MGMT_freeCertDistinguishedName(certDistinguishedName **ppFreeCertDistName)
Free certDistinguishedName structure's memory.
ubyte * value
(Optional) String containing information applicable to the oid field.
Definition: ca_mgmt.h:327
nameAttr * pNameAttr
Array of nameAttr of length dnCount.
Definition: ca_mgmt.h:403
ubyte type
(Optional) DirectoryString CHOICE for the value field, such as UTF8String.
Definition: ca_mgmt.h:320
MOC_EXTERN sbyte4 CA_MGMT_generateNakedHybridKey(ubyte4 keyType, ubyte4 legacyKeyType, ubyte4 legacyKeySize, ubyte4 qsAlgoId, ubyte **ppRetNewKeyBlob, ubyte4 *pRetNewKeyBlobLength)
Generate a naked key.
byteBoolean hasKeyUsage
TRUE specifies that the certificate contains a keyUsage extension; FALSE otherwise.
Definition: ca_mgmt.h:597
ubyte4 certLength
Number of bytes in pCertificate.
Definition: ca_mgmt.h:193
byteBoolean hasBasicConstraints
TRUE specifies that the certificate contains a basicConstraints extension; FALSE otherwise.
Definition: ca_mgmt.h:568
MOC_EXTERN MSTATUS CA_MGMT_convertRSAPublicKeyInfoDER(ubyte *pDerRsaKey, ubyte4 derRsaKeyLength, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength)
Convert the DER encoding of an RSA public key in PublicKeyInfo format into a Digicert key blob...
MOC_EXTERN MSTATUS CA_MGMT_publicKeyBlobToDER(const ubyte *pPublicKeyBlob, ubyte4 publicKeyBlobLength, ubyte **ppRetKeyDER, ubyte4 *pRetKeyDERLength)
This is an old function.
Certificate generation support for constructing an AttributeTypeAndValues ASN.1 object.
Definition: ca_mgmt.h:291
MOC_EXTERN sbyte4 CA_MGMT_allocCertDistinguishedName(certDistinguishedName **ppNewCertDistName)
Allocate and initialize a pCertificateDesc structure.
MOC_EXTERN sbyte4 CA_MGMT_extractPublicKeyInfo(ubyte *pCertificate, ubyte4 certificateLen, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLen)
Gets the public key from a certificate.
ubyte4 nameAttrCount
Number of nameAttr objects in pNameAttr.
Definition: ca_mgmt.h:408
Definition: ca_mgmt.h:646
MOC_EXTERN sbyte4 CA_MGMT_convertProtectedPKCS8KeyToKeyBlob(const ubyte *pPKCS8DER, ubyte4 pkcs8DERLen, ubyte *pPassword, ubyte4 passwordLen, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength)
Extract a protected RSA private key from a PKCS #8 DER- encoded buffer, converting it into a Digicert...
Distinguished name data (names and start/end dates) to support certificate generation.
Definition: ca_mgmt.h:424
Certificate context (information required to manage a DER-encoded X.509 certificate).
Definition: ca_mgmt.h:181
MOC_EXTERN MSTATUS CA_MGMT_keyBlobToPEM(const ubyte *pKeyBlob, ubyte4 keyBlobLength, ubyte **ppRetKeyPEM, ubyte4 *pRetKeyPEMLength)
This is an old function.
extensions * otherExts
Pointer to array of version 3 extensions.
Definition: ca_mgmt.h:623
MOC_EXTERN sbyte4 CA_MGMT_generateCertificateExType(certDescriptor *pRetCertificate, ubyte4 keyType, ubyte4 keySize, const certDistinguishedName *pCertInfo, ubyte signAlgorithm, const certExtensions *pExtensions, const certDescriptor *pParentCertificate)
Generate a signed X.509 certificate and public/private key pair.
struct AsymmetricKey * pKey
Pointer to asymmetric key; if defined, use this instead of pKeyBlob.
Definition: ca_mgmt.h:213
ubyte * oid
Extension Id: an OID defined in src/asn1/oiddefs.h.
Definition: ca_mgmt.h:511
MOC_EXTERN sbyte4 CA_MGMT_returnCertificatePrints(ubyte *pCertificate, ubyte4 certLength, ubyte *pShaFingerPrint, ubyte *pMD5FingerPrint)
Generate an X.509 certificate's SHA-1 and MD5 fingerprints.
Container for a certificate's version 3 extensions.
Definition: ca_mgmt.h:560
MOC_EXTERN MSTATUS CA_MGMT_convertIpAddress(ubyte *pIpString, ubyte *pIpBytes, ubyte4 *pIpLen)
Converts an IP address represented by a string (v4 or v6) to raw bytes.
byteBoolean isCA
TRUE specifies that the basicConstraints is a CA value; FALSE otherwise.
Definition: ca_mgmt.h:576
MOC_EXTERN MSTATUS CA_MGMT_keyBlobToDER(const ubyte *pKeyBlob, ubyte4 keyBlobLength, ubyte **ppRetKeyDER, ubyte4 *pRetKeyDERLength)
This is an old function.
MOC_EXTERN MSTATUS CA_MGMT_verifyCertDate(ubyte *pCert, ubyte4 certLen)
Validate a DER-encoded X.509 certificate's start and expiration times and dates against the current t...
MOC_EXTERN sbyte4 CA_MGMT_extractCertASN1Name(const ubyte *pCertificate, ubyte4 certificateLength, sbyte4 isSubject, sbyte4 includeASN1SeqHeader, ubyte4 *pASN1NameOffset, ubyte4 *pASN1NameLen)
Get an X.509 certificate's subject or issuer DER-encoded ASN.1 name.
byteBoolean isCritical
TRUE if extension is critical; otherwise FALSE.
Definition: ca_mgmt.h:517
MOC_EXTERN sbyte4 CA_MGMT_generateNakedKey(ubyte4 keyType, ubyte4 keySize, ubyte **ppRetNewKeyBlob, ubyte4 *pRetNewKeyBlobLength)
Generate a naked key.
MOC_EXTERN sbyte4 CA_MGMT_freeNakedKey(ubyte **ppFreeKeyBlob)
Free (release) a naked key blob's memory.
const ubyte * oid
AttributeType: attribute's OID (object identifier).
Definition: ca_mgmt.h:307
MOC_EXTERN sbyte4 CA_MGMT_extractBasicConstraint(ubyte *pCertificate, ubyte4 certificateLen, intBoolean *pIsCritical, certExtensions *pCertExtensions)
Get the BasicConstraints extension out of a cert.
ubyte * pKeyBlob
Pointer to key blob value.
Definition: ca_mgmt.h:199
ubyte * pCertificate
Pointer to DER-encoded X.509 certificate.
Definition: ca_mgmt.h:187
sbyte certPathLen
Number of certificates in the certificate chain; if negative, it's omitted from the basicConstraints...
Definition: ca_mgmt.h:588
MOC_EXTERN sbyte4 CA_MGMT_decodeCertificate(ubyte *pKeyFile, ubyte4 fileSize, ubyte **ppDecodeFile, ubyte4 *pDecodedLength)
Convert PEM-encoded certificate to DER-encoded certificate.
ubyte * value
DER-encoded extension value.
Definition: ca_mgmt.h:539
MOC_EXTERN sbyte4 CA_MGMT_freeCertificate(certDescriptor *pRetCertificateDescr)
Free memory allocated by CA_MGMT_generateCertificate().
MOC_EXTERN sbyte4 CA_MGMT_convertPKCS8KeyToKeyBlob(const ubyte *pPKCS8DER, ubyte4 pkcs8DERLen, ubyte **ppRetKeyBlob, ubyte4 *pRetKeyBlobLength)
Convert unprotected RSA private key to a Digicert SoT Platform private RSA keyblob.
MOC_EXTERN sbyte4 CA_MGMT_verifyCertWithKeyBlob(certDescriptor *pCertificateDescr, sbyte4 *pIsGood)
Verify correspondence of a certDescriptor key blob and certificate's key.
ubyte4 keyBlobLength
Number of bytes in pKeyBlob.
Definition: ca_mgmt.h:205