PFN_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC callback function (wincrypt.h)

The PFN_IMPORT_PUBLIC_KEY_INFO_EX2_FUNC callback function is called by CryptImportPublicKeyInfoEx2 to decode the public key algorithm identifier, load the algorithm provider, and import the key pair.



BOOL PfnImportPublicKeyInfoEx2Func(
  [in]  DWORD dwCertEncodingType,
  [in]  DWORD dwFlags,
  [in]  void *pvAuxInfo,
  [out] BCRYPT_KEY_HANDLE *phKey


[in] dwCertEncodingType

The certificate encoding type that was used to encrypt the subject. The message encoding type identifier, contained in the high WORD of this value, is ignored by this function.

This parameter can be the following currently defined certificate encoding type.

Value Meaning
1 (0x1)
Specifies X.509 certificate encoding.

[in] pInfo

A pointer to a CERT_PUBLIC_KEY_INFO structure that contains the public key information to import into the provider.

[in] dwFlags

A set of flags that modify the behavior of this function. This can be zero.

[in] pvAuxInfo

This parameter is reserved for future use and must be set to NULL.

[out] phKey

A pointer to a BCRYPT_KEY_HANDLE variable that receives the handle of the imported key.

Return value

If the function succeeds, the function returns nonzero (TRUE).

If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.


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

Constant Definition


Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header wincrypt.h