CryptEnumKeyIdentifierProperties

Windows CE 3.0

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] Indicates 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 (sets the cProp parameter of pfnEnum to one). All key identifiers that do not have the property are skipped.

Any certificate property identifier can be used.

dwFlags
[in] By default, the CurrentUser's list of key identifiers is searched. If CRYPT_KEYID_MACHINE_FLAG is set, the list of key identifiers of the LocalMachine (if pwszComputerName is NULL) or of a remote computer (if pwszComputerName is not NULL) is searched.
pwszComputerName
[in/optional] Pointer to a name of a remote computer to be searched. If CRYPT_KEYID_MACHINE_FLAG is set in the dwFlags parameter, it searches the remote computer for a list of key identifiers. If the local computer is to be searched and not a remote computer, the pwszComputerName parameter is set to NULL.
pvReserved
[in] Reserved for future use and must be 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 later in this topic.

Return Values

The CryptEnumKeyIdentifierProperties function repeatedly calls the pfnEnum callback function 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 (FALSE).

For extended error information, call the GetLastError function.

Remarks

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

The following signature applies to pfnEnum.

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 (see BLOB) containing the key identifier.
dwFlags
Reserved for future use and must be zero (0).
pvReserved
Reserved for future use and must be NULL.
pvArg
Pointer to an argument that is passed through from the callback function.
cProp
Count of elements in the array of rgdwPropId.
rgdwPropId
Pointer to an array of property identifiers. Each entry in the array will be one of the value types listed for in the table for dwPropId in the CryptSetKeyIdentifierProperty function.
rgpvData
Pointer to an array that contains pointers to pvData elements corresponding the rgdwPropId array elements.

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

Runs on Versions Defined in Include Link to
Windows CE OS 3.0 or later Wincrypt.h   Crypt32.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CryptGetKeyIdentifierProperty, CryptSetKeyIdentifierProperty, CRYPT_HASH_BLOB, CRYPT_KEY_PROV_INFO


 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.

Show: