CryptHashCertificate2 function

The CryptHashCertificate2 function hashes a block of data by using a CNG hash provider.

Syntax

BOOL CryptHashCertificate2(
  LPCWSTR    pwszCNGHashAlgid,
  DWORD      dwFlags,
  void       *pvReserved,
  const BYTE *pbEncoded,
  DWORD      cbEncoded,
  BYTE       *pbComputedHash,
  DWORD      *pcbComputedHash
);

Parameters

pwszCNGHashAlgid

The address of a null-terminated Unicode string that contains the CNG hash algorithm identifier of the hash algorithm to use to hash the certificate. This can be one of the CNG Algorithm Identifiers that represents a hash algorithm or any other registered hash algorithm identifier.

dwFlags

A set of flags that modify the behavior of this function. No flags are defined for this function.

pvReserved

Reserved for future use and must be NULL.

pbEncoded

The address of an array of bytes to be hashed. The cbEncoded parameter contains the size of this array.

cbEncoded

The number of elements in the pbEncoded array.

pbComputedHash

The address of a buffer that receives the computed hash. The variable pointed to by the pcbComputedHash parameter contains the size of this buffer.

pcbComputedHash

The address of a DWORD variable that, on entry, contains the size, in bytes, of the pbComputedHash buffer. After this function returns, this variable contains the number of bytes copied to the pbComputedHash buffer.

Return Value

If the function succeeds, the function returns nonzero (TRUE).

If the function fails, it returns zero (FALSE). For extended error information, call GetLastError. Some of the possible error codes are identified in the following topics.

BCryptOpenAlgorithmProvider
BCryptCreateHash
BCryptGetProperty
BCryptHashData
BCryptFinishHash

Requirements

   
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header wincrypt.h
Library Crypt32.lib
DLL Crypt32.dll

See Also

Data Management Functions