CryptEnumKeyIdentifierProperties

This function enumerates key identifiers and their properties. This function is not called in a loop. Rather, it loops internally until the last key identifier property is enumerated or the callback function returns FALSE. The callback function is called if the dwPropId parameter is zero or if the key identifier's properties match the dwPropId parameter.

BOOL WINAPI CryptEnumKeyIdentifierProperties(
  const CRYPT_HASH_BLOB* pKeyIdentifier,
  DWORD dwPropId,
  DWORD dwFlags,
  LPCWSTR pwszComputerName,
  void* pvReserved,
  void* pvArg,
  PFN_CRYPT_ENUM_KEYID_PROP pfnEnum
);

Parameters

  • pKeyIdentifier
    [in] Optional. Pointer to a CRYPT_HASH_BLOB structure containing the key identifier.

    If the pKeyIdentifier parameter is NULL, the function enumerates all key identifiers.

    If the pKeyIdentifier parameter is not NULL, the callback function pfnEnum is only called for the specified key identifier.

  • dwPropId
    [in] Specifies the property identifier to be listed.

    If the dwPropId parameter is set to zero, this function calls the callback function with all the properties.

    If dwPropId is not zero and pKeyIdentifier is NULL, the callback function is called only for those key identifiers that have the specified property. The value of the cProp parameter of the function pointed to by the pfnEnum parameter is set to one. All key identifiers that do not have the property are skipped.

    Any certificate property identifier can be used.

  • dwFlags
    [in] Bitmask of flags. By default, the CurrentUser's list of key identifiers is searched. If this parameter has a value of CRYPT_KEYID_MACHINE_FLAG, the search is instead performed on the list of key identifiers of the LocalMachine if pwszComputerName is NULL, or on the list of key identifiers of a remote computer if pwszComputerName is not NULL.

  • pwszComputerName
    [in] Optional. Pointer to a name of a remote computer to be searched. If the dwFlags parameter has a value of CRYPT_KEYID_MACHINE_FLAG, it searches the remote computer for a list of key identifiers. If the local computer is to be searched rather than a remote computer, the pwszComputerName parameter is set to NULL.

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

  • pvArg
    [in] Optional. Pointer to data to be passed to the callback function. The type is a void that allows the application to declare, define, and initialize a structure or argument to hold any information.

  • pfnEnum
    [in] Pointer to an application-defined callback function that is executed for each key identifier entry matching the input parameters. For details about the callback functions parameters, see the Remarks section.

Return Values

This function repeatedly calls the callback function pointed to by the pfnEnum parameter until the last key identifier is enumerated or the callback returns FALSE.

If the main function succeeds, the return value is nonzero, TRUE.

If the function fails, the return value is zero, or FALSE.

For extended error information, call the GetLastError function.

Remarks

A key identifier can have the same properties as a certificate context.

The following example shows the signature for the callback function pointed to by the pfnEnum parameter.

BOOL (WINAPI *PFN_CRYPT_ENUM_KEYID_PROP)(
  const CRYPT_HASH_BLOB* pKeyIdentifier,
  DWORD dwFlags,
  void* pvReserved,
  void* pvArg,
  DWORD cProp,
  DWORD* rgdwPropId,
  void** rgpvData,
  DWORD* rgcbData
);

Parameters

  • pKeyIdentifier
    Pointer to a CRYPT_HASH_BLOB structure containing the key identifier. For more information, see BLOB.

  • dwFlags
    Reserved for future use and must be set to zero.

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

  • pvArg
    Pointer to an argument that is passed through from the callback function.

  • cProp
    Count of elements in the array pointed to by the rgdwPropId parameter.

  • rgdwPropId
    Pointer to an array of property identifiers. Each entry in the array is one of the value types listed in the table for the dwPropId parameter in the CryptSetKeyIdentifierProperty function.

  • rgpvData
    Pointer to an array that contains pointers to pvData elements corresponding to the elements in the array pointed to by the rgdwPropId parameter.

    For CERT_KEY_PROV_INFO_PROP_ID, the rgpvData element points to a CRYPT_KEY_PROV_INFO structure. For all other properties, the rgpvData element points to an array of bytes.

  • rgcbData
    Array of DWORDs that specify the size, in bytes, of corresponding elements in the rgpvData array.

Return Values

Returns TRUE to continue enumeration.

Returns FALSE and sets the last error code to stop enumeration.

Requirements

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

See Also

CryptGetKeyIdentifierProperty | CryptSetKeyIdentifierProperty | CRYPT_HASH_BLOB | CRYPT_KEY_PROV_INFO

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.