Compartir a través de


CryptFindCertificateKeyProvInfo

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function enumerates the cryptographic providers and their containers to find the private key corresponding to the certificate's public key.

Syntax

BOOL WINAPI CryptFindCertificateKeyProvInfo(
  PCCERT_CONTEXT pCert,
  DWORD dwFlags,
  void* pvReserved
);

Parameters

  • pCert
    [in] Pointer to the CERT_CONTEXT structure of the certificate to use when exporting public key information.
  • dwFlags
    [in] Bitmask of flags. The following table shows flag values that are defined.

    Value Description

    CRYPT_FIND_USER_KEYSET_FLAG

    Restricts the search to the user container.

    CRYPT_FIND_MACHINE_KEYSET_FLAG

    Restricts the search to the machine container.

    If no flag value is specified, both the user and the machine containers are searched.

  • pvReserved
    [in] Reserved for future use and must be set to NULL.

    This function enumerates the cryptographic providers and their containers to find the private key corresponding 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 see if it matches the provider's public key. For a match, the function skips the previously mentioned enumeration.

Return Value

Returns TRUE if the function finds a private key corresponding to the certificate's public key within a searched container.

Returns FALSE if the function fails to find a container or a private key within a container.

The following table shows an error that the GetLastError function returns.

The GetLastError function can return NTE_NO_KEY, which indicates there was no container found.

Requirements

Header wincrypt.h
Library crypt32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CERT_CONTEXT