CryptMsgCountersign function

The CryptMsgCountersign function countersigns an existing signature in a message. Countersignatures are used to sign an existing signature's encrypted hash of the message. Countersignatures can be used for various purposes including time stamping a message.

Syntax

BOOL CryptMsgCountersign(
  HCRYPTMSG                hCryptMsg,
  DWORD                    dwIndex,
  DWORD                    cCountersigners,
  PCMSG_SIGNER_ENCODE_INFO rgCountersigners
);

Parameters

hCryptMsg

Cryptographic message handle to be used.

dwIndex

Zero-based index of the signer in the signed or signed-and-enveloped message to be countersigned.

cCountersigners

Number of countersigners in the rgCountersigners array.

rgCountersigners

Array of countersigners' CMSG_SIGNER_ENCODE_INFO structures.

Return Value

If the function succeeds, the function returns nonzero (TRUE).

If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.

An error can be propagated from CryptMsgCountersignEncoded.

The following error codes are returned most often.

Return code Description
E_INVALIDARG
One or more arguments are not valid.
E_OUTOFMEMORY
Ran out of memory.
ERROR_MORE_DATA
The specified area is not large enough to hold the returned data.
 

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

   
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header wincrypt.h
Library Crypt32.lib
DLL Crypt32.dll

See Also

CryptMsgCountersignEncoded

CryptMsgVerifyCountersignatureEncoded

Low-level Message Functions

Simplified Message Functions