CryptGetMessageSignerCount function (wincrypt.h)

The CryptGetMessageSignerCount function returns the number of signers of a signed message.

Note

This function may return a count of duplicate signers and therefore may not be sufficient to avert attacks. We recommend using the sid (SignerIdentifier) field from SignerInfo to identify duplicate signers in a message.

Syntax

LONG CryptGetMessageSignerCount(
  [in] DWORD      dwMsgEncodingType,
  [in] const BYTE *pbSignedBlob,
  [in] DWORD      cbSignedBlob
);

Parameters

[in] dwMsgEncodingType

Specifies the encoding type used. It is always acceptable to specify both the certificate and message encoding types by combining them with a bitwise-OR operation as shown in the following example:

X509_ASN_ENCODING | PKCS_7_ASN_ENCODING

Currently defined encoding types are:

  • X509_ASN_ENCODING
  • PKCS_7_ASN_ENCODING

[in] pbSignedBlob

A pointer to a buffer containing the signed message.

[in] cbSignedBlob

The size, in bytes, of the signed message.

Return value

Returns the number of signers of a signed message, zero when there are no signers, and minus one (–1) for an error.

For extended error information, call GetLastError. The following error code is most commonly returned.

Return code Description
E_INVALIDARG
Invalid message encoding type. Currently only PKCS_7_ASN_ENCODING is supported.
 

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

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

See also

CryptVerifyMessageSignature

Simplified Message Functions