Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
PFN_CMSG_CNG_IMPORT_KEY_TRANS
Collapse the table of content
Expand the table of content

PFN_CMSG_CNG_IMPORT_KEY_TRANS function pointer

The PFN_CMSG_CNG_IMPORT_KEY_TRANS callback function imports and decrypts a content encryption key (CEK) that is intended for a key transport recipient. PFN_CMSG_CNG_IMPORT_KEY_TRANS can be installed by using a Cryptography API: Next Generation (CNG) object identifier (OID).

Syntax


typedef BOOL ( WINAPI *PFN_CMSG_CNG_IMPORT_KEY_TRANS)(
  _Inout_    PCMSG_CNG_CONTENT_DECRYPT_INFO    pCNGContentDecryptInfo,
  _In_       PCMSG_CTRL_KEY_TRANS_DECRYPT_PARA pKeyTransDecryptPara,
  _In_       DWORD                             dwFlags,
  _Reserved_ void                              *pvReserved
);

Parameters

pCNGContentDecryptInfo [in, out]

A pointer to a CMSG_CNG_CONTENT_DECRYPT_INFO structure to be updated with the decrypted CEK bytes. This parameter contains the key used to decrypt the CEK. The following pKeyTransDecryptPara parameter contains the CEK bytes to be decrypted.

pKeyTransDecryptPara [in]

A pointer to a CMSG_CTRL_KEY_TRANS_DECRYPT_PARA structure that contains the key transport information passed to the CryptMsgControl function in the CMSG_CTRL_DECRYPT or CMSG_CTRL_KEY_TRANS_DECRYPT cases. For the CMSG_CTRL_DECRYPT case, CryptMsgControl converts the CMSG_CTRL_DECRYPT_PARA structure to a CMSG_CTRL_KEY_TRANS_DECRYPT_PARA structure.

The EncryptedKey member of the pKeyTrans member contains the CEK bytes to be decrypted. Because a CMSG_CTRL_KEY_TRANS_DECRYPT_PARA structure might contain an HCRYPTPROV choice, its hNCryptKey member must not be used to decrypt EncryptedKey. Instead, you must use the hNCryptKey specified in the pCNGContentDecryptInfo parameter.

This function must not update members of the CMSG_CTRL_KEY_TRANS_DECRYPT_PARA structure.

dwFlags [in]

This parameter is reserved. Set it to zero.

pvReserved

This parameter is reserved. Set it to NULL.

Return value

If the function succeeds, the return value is nonzero (TRUE).

If the function fails, the return value is zero (FALSE). For extended error information, call GetLastError.

If this callback function does not support the key encryption algorithm, it must return FALSE and call SetLastError with ERROR_NOT_SUPPORTED.

Remarks

The CryptMsgControl function calls this function for the following operations specified by the dwCtrlType parameter:

CMSG_CTRL_DECRYPT
CMSG_CTRL_KEY_TRANS_DECRYPT

You can use OID Support Functions to deploy this callback function. Wincrypt.h defines the following constant for this purpose.

ConstantDefinition
CMSG_OID_CNG_IMPORT_KEY_TRANS_FUNC"CryptMsgDllCNGImportKeyTrans"

 

Examples

For an example that deploys an OID-installable callback function, see Extending CryptoAPI Functionality.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Wincrypt.h

See also

Decoding Enveloped Data

 

 

Community Additions

ADD
Show:
© 2015 Microsoft