Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This function hashes the entire encoded content of a certificate including its signature.

Syntax

BOOL WINAPI CryptHashCertificate(
  HCRYPTPROV 
hCryptProv,
  ALG_ID 
Algid,
  DWORD 
dwFlags,
  const BYTE* 
pbEncoded,
  DWORD 
cbEncoded,
  BYTE* 
pbComputedHash,
  DWORD* 
pcbComputedHash
);

Parameters

hCryptProv

[in] Handle to the CSP used to compute the hash.

Unless there is a strong reason for passing in a specific cryptographic provider in the hCryptProvparameter, 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.

Algid

[in] ALG_IDstructure that specifies the hash algorithm to use. If the value of this parameter is zero, the default hash algorithm, SHA1, is used.

dwFlags

[in] Specifies the value to be passed to the hash API. For more information, see CryptCreateHash.

pbEncoded

[in] Address of the encoded content to be hashed.

cbEncoded

[in] Size, in bytes, of the encoded content.

pbComputedHash

[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.

pcbComputedHash

[in, out] On input, pointer to a DWORDthat contains the size, in bytes, of the buffer pointed to by the pbComputedHashparameter. On output, the DWORDcontains the number of bytes stored in the buffer.

When processing the data returned in the buffer, applications must 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 Value

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 GetLastErrorfunction.

Errors from the called CryptCreateHash, CryptGetHashParam, and CryptHashDatafunctions might be propagated to this function.

Requirements

Header wincrypt.h
Library crypt32.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also