Compartilhar via


CryptVerifyMessageHash (Compact 2013)

3/28/2014

This function verifies the hash of the specified content.

Syntax

BOOL WINAPI CryptVerifyMessageHash(
        __in PCRYPT_HASH_MESSAGE_PARA pHashPara,
        __in BYTE *pbHashedBlob,
        __in DWORD cbHashedBlob,
        __out BYTE *pbToBeHashed,
        __inout DWORD *pcbToBeHashed,
        __out_opt BYTE *pbComputedHash,
        __inout_opt DWORD *pcbComputedHash
);

Parameters

  • pbHashedBlob
    [in] Pointer to a buffer that contains original content and its hash.
  • cbHashedBlob
    [in] The size, in bytes, of the original hash buffer.
  • pbToBeHashed
    [out] Pointer to a buffer to receive the original content that was hashed.

    This parameter can be NULL if the original content is not needed for additional processing, or to set the size of the original content for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.

  • pcbToBeHashed
    [in, out] Pointer to a DWORD that specifies the size, in bytes, of the pbToBeHashed buffer. When the function returns, this variable contains the size, in bytes, of the original content copied to pbToBeHashed. The original content will not be returned if this parameter is NULL.

    Note

    When processing the data returned, 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 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.

  • pbComputedHash
    [out, optional] Pointer to a buffer to receive the computed hash. This parameter can be NULL if the created hash is not needed for additional processing, or to set the size of the original content for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.
  • pcbComputedHash
    [in, out, optional] Pointer to a DWORD that specifies the size, in bytes, of the pbComputedHash buffer. When the function returns, this variable contains the size, in bytes, of the created hash. The hash is not returned if this parameter is NULL.

    Note

    When processing the data returned, 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 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.

Return Value

If the function succeeds, the return value is nonzero (TRUE); otherwise, it is zero (FALSE).

For extended error information, call GetLastError.

The following table lists the error codes most commonly returned by the GetLastError function.

Error code

Description

CRYPT_E_UNEXPECTED_MSG_TYPE

Not a hashed cryptographic message.

E_INVALIDARG

The message encoding type is not valid. Currently only PKCS_7_ASN_ENCODING is supported. The cbSize in *pHashPara is not valid.

ERROR_MORE_DATA

If the buffer specified by the pbToBeHashed 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 pcbToBeHashed.

Note

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

If the function fails, GetLastError may return an Abstract Syntax Notation One (ASN.1) encoding/decoding error. For information about these errors, see ASN.1 Encoding/Decoding Return Values.

Requirements

Header

wincrypt.h

Library

crypt32.lib

See Also

Reference

Certificates Functions