This topic has not yet been rated - Rate this topic

CryptHashCertificate2 function

Applies to: desktop apps only

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

Syntax

BOOL WINAPI CryptHashCertificate2(
  __in        LPCWSTR pwszCNGHashAlgid,
  __in        DWORD dwFlags,
  __reserved  void *pvReserved,
  __in        BYTE *pbEncoded,
  __in        DWORD cbEncoded,
  __out       BYTE *pbComputedHash,
  __inout     DWORD *pcbComputedHash
);

Parameters

pwszCNGHashAlgid [in]

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 [in]

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 [in]

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

cbEncoded [in]

The number of elements in the pbEncoded array.

pbComputedHash [out]

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 [in, out]

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

Minimum supported server

Windows Server 2008

Header

Wincrypt.h

Library

Crypt32.lib

DLL

Crypt32.dll

See also

Data Management Functions

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ