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] Specifies the property to retrieve. The value of the dwPropId parameter determines the type and content of the pvData parameter. Any certificate property identifier can be used.dwFlags
[in] Bitmask of flags. The following table shows the defined values for this parameter*,* which can be combined with a bitwise OR operation.Value Description CRYPT_KEYID_MACHINE_FLAG Searches the list of key identifiers of the local machine (if the pwszComputerName parameter is NULL) or remote computer (if the pwszComputerName parameter is not NULL). CRYPT_KEYID_ALLOC_FLAG The LocalAlloc function 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 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, set the pwszComputerName parameter to NULL.pvReserved
[in] Reserved for future use and must be set to 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 the pcbData parameter 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] On input, pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pvData parameter. On output, 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 the value of the dwFlags parameter is CRYPT_KEYID_ALLOC_FLAG, pcibData is the address of a pointer to the DWORD that will be updated.
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, or TRUE.
If the function fails, the return value is zero, or FALSE.
For extended error information, call the GetLastError function.
Requirements
OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.
Link Library: Crypt32.lib.
See Also
CryptEnumKeyIdentifierProperties | CryptSetKeyIdentifierProperty | CRYPT_HASH_BLOB | CRYPT_KEY_PROV_INFO
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.