Share via


CryptFindCertificateKeyProvInfo

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

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 Values

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

OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.
Link Library: Crypt32.lib.

See Also

CERT_CONTEXT

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.