CryptGetMessageSignerCount function (wincrypt.h)

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


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.


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


[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:


Currently defined encoding types are:


[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
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.


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


Simplified Message Functions