PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC callback function (wincrypt.h)
The PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC callback function is called by CryptExportPublicKeyInfoEx to export a public key BLOB and encode it.
Syntax
PFN_CRYPT_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC PfnCryptExportPublicKeyInfoEx2Func;
BOOL PfnCryptExportPublicKeyInfoEx2Func(
[in] NCRYPT_KEY_HANDLE hNCryptKey,
[in] DWORD dwCertEncodingType,
[in] LPSTR pszPublicKeyObjId,
[in] DWORD dwFlags,
[in, optional] void *pvAuxInfo,
[out, optional] PCERT_PUBLIC_KEY_INFO pInfo,
[in, out] DWORD *pcbInfo
)
{...}
Parameters
[in] hNCryptKey
A handle of the cryptographic service provider (CSP) to use when exporting the public key information. This handle must be an NCRYPT_KEY_HANDLE handle that has been created by using the NCryptOpenKey function.
[in] dwCertEncodingType
A value that specifies the encoding type used. It is always acceptable to specify both the certificate and message encoding types by combining them with a bitwise-OR operation as shown in the following example:
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING
Currently defined encoding types are:
- X509_ASN_ENCODING
- PKCS_7_ASN_ENCODING
[in] pszPublicKeyObjId
A pointer to a string that contains the public key algorithm.
[in] dwFlags
A value that indicates how the public key information is exported. This can be zero.
[in, optional] pvAuxInfo
This parameter is reserved for future use and must be set to NULL.
[out, optional] pInfo
A pointer to a CERT_PUBLIC_KEY_INFO structure to receive the public key information to be exported.
This parameter can be NULL to set the size of this information for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.
[in, out] pcbInfo
A pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pInfo parameter. When the function returns, the DWORD contains the number of bytes stored in the buffer.
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 signature algorithm, it must return FALSE and call SetLastError with ERROR_NOT_SUPPORTED.
Remarks
You can use OID Support Functions to deploy this callback function. Wincrypt.h defines the following constant for this purpose.
Constant | Definition |
---|---|
CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_EX2_FUNC | "CryptDllExportPublicKeyInfoEx2" |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |