次の方法で共有


CryptVerifyDetachedMessageSignature (Compact 2013)

3/28/2014

This function verifies a signed message that contains a detached signature or signatures.

Syntax

BOOL WINAPI CryptVerifyDetachedMessageSignature (
    __in PCRYPT_VERIFY_MESSAGE_PARA pVerifyPara,
    __in DWORD dwSignerIndex,
    __in const BYTE *pbDetachedSignBlob,
    __in DWORD cbDetachedSignBlob,
    __in DWORD cToBeSigned,
    __in const BYTE *rgpbToBeSigned[],
    __in DWORD rgcbToBeSigned[],
    __out_opt PCCERT_CONTEXT *ppSignerCert
);

Parameters

  • dwSignerIndex
    [in] Index of the signature to be verified. A message might have several signers and this function can be called repeatedly, changing dwSignerIndex to verify other signatures. If the function returns FALSE, and GetLastError returns CRYPT_E_NO_SIGNER, the previous call received the last signer of the message.
  • pbDetachedSignBlob
    [in] A pointer to a BLOB that contains the encoded message signatures.
  • cbDetachedSignBlob
    [in] The size, in bytes, of the detached signature.
  • cToBeSigned
    [in] Number of array elements in rgpbToBeSigned and rgcbToBeSigned.
  • rgpbToBeSigned
    [in] Array of pointers to buffers that contain the contents to be hashed.
  • rgcbToBeSigned
    [in] Array of sizes, in bytes, for the content buffers pointed to in rgpbToBeSigned.
  • ppSignerCert
    [out, optional] A pointer to a pointer to a CERT_CONTEXT structure of a signer certificate. When you have finished using the certificate context, free it by calling the CertFreeCertificateContext function. A pointer to a CERT_CONTEXT structure will not be returned if this parameter is NULL.

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

E_INVALIDARG

Invalid message and certificate encoding types. Currently only PKCS_7_ASN_ENCODING and X509_ASN_ENCODING_TYPE are supported. Invalid cbSize in *pVerifyPara.

CRYPT_E_UNEXPECTED_MSG_TYPE

Not a signed cryptographic message.

CRYPT_E_NO_SIGNER

The message does not have any signers or a signer for the specified dwSignerIndex.

NTE_BAD_ALGID

The message was hashed and signed by using an unknown or unsupported algorithm.

NTE_BAD_SIGNATURE

The message's signature was not verified.

Note

Errors from the called functions CryptCreateHash, CryptHashData, CryptVerifySignature, and CryptImportKey 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