This function encodes the public key information in a CERT_PUBLIC_KEY_INFO structure and computes the hash of the encoded bytes. The hash created is used with key identifier functions.
BOOL WINAPI CryptHashPublicKeyInfo( HCRYPTPROV hCryptProv, ALG_ID Algid, DWORD dwFlags, DWORD dwCertEncodingType, PCERT_PUBLIC_KEY_INFO pInfo, BYTE *pbComputedHash, DWORD *pcbComputedHash );
- [in] Handle of the CSP used to compute the hash.
Unless there is a strong reason for passing in a specific cryptographic provider in the hCryptProv parameter, zero is passed in. Passing in zero causes the default RSA or DSS provider to be acquired before doing hash, signature verification or recipient encryption operations.
- [in] ALG_ID structure that specify the CryptoAPI hash algorithm to use. If the Algid parameter is zero, the default hash algorithm, SHA1, is used.
- [in] Values to be passed on to the CryptCreateHash function.
- [in] Specifies the encoding type used. Currently, only X509_ASN_ENCODING is used; however, additional encoding types may be added in the future.
- [in] Pointer to a CERT_PUBLIC_KEY_INFO structure containing the public key information to be encoded and hashed.
- [out] Pointer to a buffer to receive the computed hash.
This parameter can be NULL to set the size of this information for memory allocation purposes.
- [in/out] Pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pbComputedHash parameter. When the function returns, the DWORD contains the number of bytes stored in the buffer.
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 will fit 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.
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.
Note Errors from the called CryptCreateHash, CryptGetHashParam, and CryptHashData functions can be propagated to this function. The following table shows the error codes for this function.
|ERROR_MORE_DATA||If the buffer specified by the pbComputedHash parameter is not large enough to hold the returned data, the function sets the ERROR_MORE_DATA code and stores the required buffer size, in bytes, into the variable pointed to by the pcbComputedHash parameter.|
|ERROR_FILE_NOT_FOUND||Invalid certificate encoding type. Currently only X509_ASN_ENCODING is supported.|
The desktop platform supports the PKCS_7_ASN_ENCODING flag, but Windows CE does not. Windows CE ignores the flag when it is specified.
|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.
Last updated on Tuesday, July 13, 2004
© 1992-2000 Microsoft Corporation. All rights reserved.