CryptVerifyMessageSignatureWithKey function (wincrypt.h)
The CryptVerifyMessageSignatureWithKey function verifies a signed message's signature by using specified public key information.
Syntax
BOOL CryptVerifyMessageSignatureWithKey(
[in] PCRYPT_KEY_VERIFY_MESSAGE_PARA pVerifyPara,
[in] PCERT_PUBLIC_KEY_INFO pPublicKeyInfo,
[in] const BYTE *pbSignedBlob,
[in] DWORD cbSignedBlob,
[out] BYTE *pbDecoded,
[in, out] DWORD *pcbDecoded
);
Parameters
[in] pVerifyPara
A pointer to a CRYPT_KEY_VERIFY_MESSAGE_PARA structure that contains verification parameters.
[in] pPublicKeyInfo
A pointer to a CERT_PUBLIC_KEY_INFO structure that contains the public key that is used to verify the signed message. If NULL, the signature is not verified.
[in] pbSignedBlob
A pointer to a buffer that contains the signed message.
[in] cbSignedBlob
The size, in bytes, of the signed message buffer.
[out] pbDecoded
A pointer to a buffer to receive the decoded message.
This parameter can be NULL if the decoded message is not needed for additional processing or to set the size of the message for memory allocation purposes. For more information, see Retrieving Data of Unknown Length.
[in, out] pcbDecoded
A pointer to a DWORD value that specifies the size, in bytes, of the pbDecoded buffer. When the function returns, this DWORD contains the size, in bytes, of the decoded message. The decoded message will not be returned if this parameter is NULL.
Return value
If the function succeeds, the function returns nonzero.
If the function fails, it returns zero. For extended error information, call GetLastError.
The following table shows the error codes most commonly returned by the GetLastError function.
Return code | Description |
---|---|
|
If the buffer specified by the pbDecoded 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, in the variable pointed to by pcbDecoded. |
|
Invalid message and certificate encoding types. Currently only PKCS_7_ASN_ENCODING and X509_ASN_ENCODING_TYPE are supported. Invalid cbSize in *pVerifyPara. |
|
Not a signed cryptographic message. |
|
The message does not have any signers or a signer for the specified dwSignerIndex. |
|
The message was hashed and signed by using an unknown or unsupported algorithm. |
|
The message's signature was not verified. |
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Crypt32.lib |
DLL | Crypt32.dll |