CMSG_CNG_CONTENT_DECRYPT_INFO structure (wincrypt.h)
The CMSG_CNG_CONTENT_DECRYPT_INFO structure contains all the relevant information passed between CryptMsgControl and object identifier (OID) installable functions for the import and decryption of a Cryptography API: Next Generation (CNG) content encryption key (CEK). The CryptMsgControl function uses this structure to call the following functions:
Syntax
typedef struct _CMSG_CNG_CONTENT_DECRYPT_INFO {
DWORD cbSize;
CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm;
PFN_CMSG_ALLOC pfnAlloc;
PFN_CMSG_FREE pfnFree;
NCRYPT_KEY_HANDLE hNCryptKey;
BYTE *pbContentEncryptKey;
DWORD cbContentEncryptKey;
BCRYPT_KEY_HANDLE hCNGContentEncryptKey;
BYTE *pbCNGContentEncryptKeyObject;
} CMSG_CNG_CONTENT_DECRYPT_INFO, *PCMSG_CNG_CONTENT_DECRYPT_INFO;
Members
cbSize
Contains the size, in bytes, of this structure.
ContentEncryptionAlgorithm
A CRYPT_ALGORITHM_IDENTIFIER structure that specifies the algorithm used to encrypt the message contents and any associated parameters.
pfnAlloc
A pointer to an installable function used to allocate memory for any updated member.
pfnFree
A pointer to an installable function used to free memory allocated by pfnAlloc.
hNCryptKey
A handle to the CNG private key to be used for decryption of the CEK contained in the pKeyTransDecryptPara parameter or the pKeyAgreeDecryptPara parameter of the PFN_CMSG_CNG_IMPORT_KEY_TRANS function. Callback functions must use this key instead of the one contained in the DecryptPara structure because that structure might contain a converted HCRYPTPROV handle.
pbContentEncryptKey
Using the hNCryptKey member, the PFN_CMSG_CNG_IMPORT_KEY_TRANS function must update this member by decrypting the CEK in the pKeyTransDecryptPara parameter or the PFN_CMSG_CNG_IMPORT_KEY_AGREE function must update this member by decrypting the EncryptedKey in the pKeyAgreeDecryptPara parameter. The memory for this member must be allocated by using the pfnAlloc member. The PFN_CMSG_CNG_IMPORT_CONTENT_ENCRYPT_KEY function will use these bytes as the secret to generate the hCNGContentEncryptKey member. Even for an error, you must free and zero any allocated memory by using the pfnFree member.
cbContentEncryptKey
The PFN_CMSG_CNG_IMPORT_KEY_TRANS or PFN_CMSG_CNG_IMPORT_KEY_AGREE function must update this member with the size, in bytes, of the above pbContentEncryptKey member.
hCNGContentEncryptKey
The PFN_CMSG_CNG_IMPORT_CONTENT_ENCRYPT_KEY function must update this member with the generated BCRYPT_KEY_HANDLE to be used for content decryption. Even for an error, you must release this handle by using the BCryptDestroyKey function.
pbCNGContentEncryptKeyObject
The PFN_CMSG_CNG_IMPORT_CONTENT_ENCRYPT_KEY function must update this member with the memory allocated by the pfnAlloc member to be associated with the hCNGContentEncryptKey member. Even for an error, you must free and zero any allocated memory by using the pfnFree member.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Header | wincrypt.h |