CryptFindCertificateKeyProvInfo function (wincrypt.h)
The CryptFindCertificateKeyProvInfo function enumerates the cryptographic providers and their containers to find the private key that corresponds to the certificate's public key.
Syntax
BOOL CryptFindCertificateKeyProvInfo(
[in] PCCERT_CONTEXT pCert,
[in] DWORD dwFlags,
[in] void *pvReserved
);
Parameters
[in] pCert
A pointer to the CERT_CONTEXT structure of the certificate to use when exporting public key information.
[in] dwFlags
A set of flags that modify the behavior of this function. This can be zero or one of the following values.
The following flags determine which technology is used to obtain the key. If none of these flags is present, this function will only attempt to obtain the key by using CryptoAPI.
Windows Server 2003 and Windows XP: These flags are not supported.
[in] pvReserved
Reserved for future use and must be NULL.
Return value
TRUE if the function finds a private key that corresponds to the certificate's public key within a searched container; FALSE if the function fails to find a container or a private key within a container.
GetLastError returns the following error:
Return code | Description |
---|---|
|
No container found. |
Remarks
This function enumerates the cryptographic providers and their containers to find the private key that corresponds to the certificate's public key. For a match, the function updates the certificate's CERT_KEY_PROV_INFO_PROP_ID property. If the CERT_KEY_PROV_INFO_PROP_ID is already set, it is checked to determine whether it matches the provider's public key. For a match, the function skips the previously mentioned enumeration.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Crypt32.lib |
DLL | Crypt32.dll |