Share via


CryptGetKeyIdentifierProperty

This function acquires a specific property from a specified key identifier.

BOOL WINAPI CryptGetKeyIdentifierProperty(
const CRYPT_HASH_BLOB *pKeyIdentifier,
DWORD dwPropId,
DWORD dwFlags,
LPCWSTR pwszComputerName,
void *pvReserved,
void *pvData,
DWORD *pcbData
);

Parameters

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

  • dwPropId
    [in] Identifies the property to retrieve. The value of the dwPropId parameter determines the type and content of the pvData parameter. Any certificate property ID can be used.

  • dwFlags
    [in] The following table shows the defined dwFlags, which can be combined with a bitwise OR operation.

    Value Description
    CRYPT_KEYID_MACHINE_FLAG Searches the list of key identifiers of LocalMachine (if the pwszComputerName parameter is NULL) or remote computer (if the pwszComputerName parameter is not NULL).
    CRYPT_KEYID_ALLOC_FLAG LocalAlloc() is called to allocate memory for pvData. The *pvData parameter is updated with a pointer to the allocated memory. LocalFree() must be called to free the allocated memory.
  • pwszComputerName
    [in] Pointer to a name of a remote computer to be searched. If CRYPT_KEYID_MACHINE_FLAG is set, it searches the remote computer for a list of key identifiers. If the local computer is to be searched and not a remote computer, set the pwszComputerName parameter to NULL.

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

  • pvData
    [OUT] Pointer to a buffer to receive the data as determined by the dwPropId parameter. Elements pointed to by fields in the pvData parameter follow the structure. Therefore, the size contained in pcbData can exceed the size of the structure.

    If dwPropId is CERT_KEY_PROV_INFO_PROP_ID, pvData points to a CRYPT_KEY_PROV_INFO structure containing the property of the key identifier.

    If dwPropId is not CERT_KEY_PROV_INFO_PROP_ID, pvData points to an array of bytes containing the property of the key identifier.

    When CRYPT_KEYID_ALLOC_FLAG is not set, this parameter can be NULL to get the size of this information for memory allocation purposes.

    When CRYPT_KEYID_ALLOC_FLAG is set, pvData is the address of a pointer to the buffer that will be updated. Because memory is allocated and its pointer is stored at *pvData, pvData must be non-NULL.

  • pcbData
    [in/out] Pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pvData parameter. When the function returns, the DWORD contains the number of bytes stored in the buffer. The size contained in the variable pointed to by pcbData can indicate a size larger than the CRYPT_KEY_PROV_INFO structure as the structure can contain pointers to auxiliary data. This size is the sum of the size needed by the structure and all auxiliary data.

    When CRYPT_KEYID_ALLOC_FLAG is set, pcibData is the address of a pointer to the DWORD that will be updated.

    Note When processing the data returned in the buffer, applications need to use the actual size of the data returned. The actual size can be slightly smaller than the size of the buffer specified on input. (On input, buffer sizes are usually specified large enough to ensure that the largest possible output data fits in the buffer.) On output, the variable pointed to by this parameter is updated to reflect the actual size of the data copied to the buffer.

Return Values

If the 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.

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

CryptEnumKeyIdentifierProperties, CryptSetKeyIdentifierProperty, CRYPT_HASH_BLOB, CRYPT_KEY_PROV_INFO

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.