18 #ifndef __PKCS12_HEADER__ 19 #define __PKCS12_HEADER__ 21 #include "../common/sizedbuffer.h" 29 #ifdef __ENABLE_MOCANA_PKCS12__ 31 MOC_EXTERN
const ubyte pkcs12_bagtypes_root_OID[];
32 MOC_EXTERN
const ubyte pkcs12_Pbe_root_OID[];
50 #ifndef __DISABLE_MOCANA_PKCS12_X509_CERTTYPE_DEFINITION__ 64 PKCS12Mode_Privacy_none = 0,
65 PKCS12Mode_Privacy_data,
66 PKCS12Mode_Privacy_password,
67 PKCS12Mode_Privacy_pubKey,
68 PKCS12Mode_Integrity_password,
69 PKCS12Mode_Integrity_pubKey
79 PKCS12_AttributeType_friendlyName = 0,
80 PKCS12_AttributeType_localKeyId
371 const ubyte* content,
428 ASN1_ITEM* pRootItem,
430 const ubyte* uniPassword,
434 void* handlerContext,
479 MOC_EXTERN MSTATUS
PKCS12_decrypt(MOC_SYM(hwAccelDescr hwAccelCtx)
480 ASN1_ITEMPTR pEncryptedData,
481 ASN1_ITEMPTR pAlgoIdentifier,
482 CStream s,
const ubyte* password,
484 ubyte** decryptedInfo,
485 sbyte4* decryptedInfoLen);
540 MOC_EXTERN MSTATUS
PKCS12_encrypt(MOC_SYM(hwAccelDescr hwAccelCtx)
542 const ubyte* password, sbyte4 passwordLen,
543 const ubyte* salt, sbyte4 saltLen, ubyte4 iterCount,
544 ubyte* plainText, sbyte4 plainTextLen);
756 randomContext* pRandomContext,
757 ubyte4 integrityMode,
759 const ubyte* pIntegrityPswd,
760 ubyte4 integrityPswdLen,
762 AsymmetricKey* pVsrcSigK,
763 const ubyte* pDigestAlgoOID,
764 CStream csSignerCertificate[],
765 ubyte4 numSignerCerts,
770 ubyte4 numPKCS12DataObj,
772 ubyte** ppRetPkcs12CertDer, ubyte4* pRetPkcs12CertDerLen);
818 MOC_HW(hwAccelDescr hwAccelCtx)
820 ubyte4 pkcs12DataLen,
824 ubyte4 privacyPswdLen,
825 ubyte *pIntegrityPswd,
826 ubyte4 integrityPswdLen,
827 SizedBuffer **ppCerts,
830 ubyte4 *pKeyBlobLen);
880 MOC_HW(hwAccelDescr hwAccelCtx)
881 randomContext *pRandomContext,
890 ubyte4 pkcs12EncryptionType,
892 ubyte4 privacyPswdLen,
893 ubyte *pIntegrityPswd,
894 ubyte4 integrityPswdLen,
895 ubyte **ppRetPkcs12CertDer,
896 ubyte4 *pRetPkcs12CertDerLen);
951 MOC_HW(hwAccelDescr hwAccelCtx)
952 randomContext *pRandomContext,
961 ubyte4 pkcs12EncryptionType,
963 ubyte4 encKeyCertLen,
964 const ubyte *pEncAlgoId,
965 ubyte *pIntegrityKeyblob,
966 ubyte4 integrityKeyblobLen,
967 ubyte *pIntegrityCert,
968 ubyte4 integrityCertLen,
969 const ubyte *pDigestAlgoOID,
970 ubyte **ppRetPkcs12CertDer,
971 ubyte4 *pRetPkcs12CertDerLen);
MOC_EXTERN MSTATUS PKCS12_encrypt(MOC_SYM(hwAccelDescr hwAccelCtx) ubyte pbeSubType, const ubyte *password, sbyte4 passwordLen, const ubyte *salt, sbyte4 saltLen, ubyte4 iterCount, ubyte *plainText, sbyte4 plainTextLen)
Encrypt a buffer, typically a public key, according to the specified algorithm.
ubyte4 numPKCS12AttrValue
Number of PKCS12AtttributeUserValue instances in ppPKCS12AttrValue.
Definition: pkcs12.h:226
Content to be published in the PKCS #12 file with the privacy mode.
Definition: pkcs12.h:132
ubyte4 encKeyType
PKCS #8 encrytion key type; any of the PKCS8EncryptionType enum values from pkcs_key.h.
Definition: pkcs12.h:158
MSTATUS(* PKCS12_contentHandler)(const void *context, contentTypes type, ubyte4 extraInfo, const ubyte *content, ubyte4 contentLen)
Process and return the information extracted from a PFX PDU.
Definition: pkcs12.h:369
certTypes eCertType
Type of certificate; any of the certTypes enum values from pkcs12.h.
Definition: pkcs12.h:188
MOC_EXTERN MSTATUS PKCS12_decrypt(MOC_SYM(hwAccelDescr hwAccelCtx) ASN1_ITEMPTR pEncryptedData, ASN1_ITEMPTR pAlgoIdentifier, CStream s, const ubyte *password, sbyte4 passwordLen, ubyte **decryptedInfo, sbyte4 *decryptedInfoLen)
Decrypt data according to a given algorithm, pAlgorithmIdentifier.
ePKCS12AttributeType
Enumeration of PKCS #12 attributes.
Definition: pkcs12.h:77
ubyte4 privacyPasswordLen
Length, in bytes, of the password referenced by pPrivacyPassword.
Definition: pkcs12.h:271
ubyte4 valueLen
Length of the attribute value, PKCS12AttributeUserValue::pValue.
Definition: pkcs12.h:118
ePKCS12Mode
Enumeration of PKCS12 encryption and integrity modes.
Definition: pkcs12.h:62
ubyte4 certificateLen
Length of certificate file to publish, PKCS12DataObject::pCertificate.
Definition: pkcs12.h:200
const ubyte * pPrivacyPassword
Password for the privacy (encryption) mode; if it is NULL/0, the password from Integrity password mod...
Definition: pkcs12.h:264
PKCS12AttributeUserValue ** ppPKCS12AttrValue
NULL if no parameters required; otherwise pointer to PKCS12AtttributeUserValue object instance(s)...
Definition: pkcs12.h:219
MOC_EXTERN MSTATUS PKCS12_EncryptPFXPduPwMode(randomContext *pRandomContext, SizedBuffer *pCerts, ubyte4 certCount, ubyte *pKeyBlob, ubyte4 keyBlobLen, ubyte *pCA, ubyte4 caLen, ubyte *pEncPw, ubyte4 encPwLen, ubyte4 pkcs12EncryptionType, ubyte *pPrivacyPswd, ubyte4 privacyPswdLen, ubyte *pIntegrityPswd, ubyte4 integrityPswdLen, ubyte **ppRetPkcs12CertDer, ubyte4 *pRetPkcs12CertDerLen)
Create a password integrity mode encrypted PFX PDU.
Nickname and/or identifier for keys; as defined in Section 4.2, "PKCS12AttrSet,", in PKCS 12 v1...
Definition: pkcs12.h:100
const ubyte * pEncryptionAlgoOID
For public key privacy, encryption to apply.
Definition: pkcs12.h:299
ubyte * pCrl
Stream containing the CRL to publish in PKCS #12.
Definition: pkcs12.h:205
Configuration information for PKCS 12 privacy (encryption) operations.
Definition: pkcs12.h:254
CStream ** ppCSDestPubKeyStream
Pointer to array of CStream objects containing the public key(s).
Definition: pkcs12.h:304
ubyte4 crlLen
Length of the CRL data object to publish, KCS12DataObject::pCrl.
Definition: pkcs12.h:212
ePKCS12Mode privacyMode
Encryption and integrity to apply to the data; any of the ePKCS12Mode enum values from pkcs12...
Definition: pkcs12.h:148
certTypes
Enumeration of certificate types for PKCS #12.
Definition: pkcs12.h:48
ubyte * pCertificate
DER-encoded certificate file to publish in PKCS #12.
Definition: pkcs12.h:193
ubyte4 pkcs12EncryptionType
For password privacy, encryption to apply; default = PCKS8_EncryptionType_pkcs12_sha_rc2_40.
Definition: pkcs12.h:286
Pointers to PKCS #7 callback functions required by PKCS #12 functions.
Definition: pkcs7.h:352
MOC_EXTERN MSTATUS PKCS12_EncryptPFXPduCertMode(randomContext *pRandomContext, SizedBuffer *pCerts, ubyte4 certCount, ubyte *pKeyBlob, ubyte4 keyBlobLen, ubyte *pCA, ubyte4 caLen, ubyte *pEncPw, ubyte4 encPwLen, ubyte4 pkcs12EncryptionType, ubyte *pEncKeyCert, ubyte4 encKeyCertLen, const ubyte *pEncAlgoId, ubyte *pIntegrityKeyblob, ubyte4 integrityKeyblobLen, ubyte *pIntegrityCert, ubyte4 integrityCertLen, const ubyte *pDigestAlgoOID, ubyte **ppRetPkcs12CertDer, ubyte4 *pRetPkcs12CertDerLen)
Create a key integrity mode encrypted PFX PDU.
MOC_EXTERN MSTATUS PKCS12_EncryptPFXPdu(MOC_HW(hwAccelDescr hwAccelCtx) randomContext *pRandomContext, ubyte4 integrityMode, const ubyte *pIntegrityPswd, ubyte4 integrityPswdLen, AsymmetricKey *pVsrcSigK, const ubyte *pDigestAlgoOID, CStream csSignerCertificate[], ubyte4 numSignerCerts, const PKCS12PrivacyModeConfig *pPkcs12PrivacyModeConfig, PKCS12DataObject pkcs12DataObject[], ubyte4 numPKCS12DataObj, ubyte **ppRetPkcs12CertDer, ubyte4 *pRetPkcs12CertDerLen)
Create an encrypted PFX PDU.
ubyte4 numPubKeyStream
Number of elements in the ppCSDestPubKeyStream CStream array.
Definition: pkcs12.h:309
MOC_EXTERN MSTATUS PKCS12_DecryptPFXPduPwMode(ubyte *pPkcs12Data, ubyte4 pkcs12DataLen, ubyte *pEncPw, ubyte4 encPwLen, ubyte *pPrivacyPswd, ubyte4 privacyPswdLen, ubyte *pIntegrityPswd, ubyte4 integrityPswdLen, SizedBuffer **ppCerts, ubyte4 *pCertCount, ubyte **ppKeyBlob, ubyte4 *pKeyBlobLen)
Decrypt a password integrity mode encrypted PFX PDU.
ubyte4 keyPasswordLen
Length of the password (in bytes).
Definition: pkcs12.h:176
ePKCS12AttributeType eAttrType
Attribute type; any of the ePKCS12AttributeType enum values defined in pkcs12.h.
Definition: pkcs12.h:108
MOC_EXTERN const BulkEncryptionAlgo * PKCS12_GetEncryptionAlgo(ubyte pbeSubType)
Return function pointers for create, delete, and decrypt/encrypt operations for the specified PBE sub...
ubyte * pValue
Pointer to attribute value.
Definition: pkcs12.h:113
MOC_EXTERN MSTATUS PKCS12_ExtractInfo(MOC_HW(hwAccelDescr hwAccelCtx) ASN1_ITEM *pRootItem, CStream s, const ubyte *uniPassword, sbyte4 uniPassLen, void *pkcs7CBArg, PKCS7_Callbacks *pkcs7CBs, void *handlerContext, PKCS12_contentHandler handler)
Extract and decrypt information from a PFX PDU, and submit the information to the given callback...
contentTypes
Enumeration of content types for PKCS #12.
Definition: pkcs12.h:38
Structure to hold function pointers to symmetric key cipher methods.
Definition: crypto.h:48
AsymmetricKey * pPrivateKey
Private key to publish in PKCS #12.
Definition: pkcs12.h:181
const ubyte * pKeyPassword
Password for key encryption.
Definition: pkcs12.h:168