CryptMsgCountersign

The CryptMsgCountersign function countersigns an already existing signature in a message. Countersignatures are used to sign an existing signature's encrypted digest. Countersignatures can be used for various purposes, such as time stamping a message.

#include <wincrypt.h>
BOOL WINAPI CryptMsgCountersign(
  HCRYPTMSG hCryptMsg,                       // in
  DWORD dwIndex,                             // in
  DWORD cCountersigners,                     // in
  PCMSG_SIGNER_ENCODE_INFO rgCountersigners  // in
);
 

Parameters

hCryptMsg
The cryptographic message handle to be used.
dwIndex
A zero-based index of the signer in the signed or signed-and-enveloped message to be countersigned.
cCountersigners
The number of countersigners in the rgCountersigners array.
rgCountersigners
The array of countersigners (CMSG_SIGNER_ENCODE_INFO structures).

Return Values

If the function fails, the return value is FALSE (zero). If it succeeds, the return value is TRUE (non-zero).

To retrieve extended error information, use the GetLastError function.

The following table lists the error codes most commonly returned by the GetLastError function.

Error code Description
CRYPT_E_OSS_ERROR OSS Certificate encode/decode error code base. Note, to get the OSS error subtract CRYPT_E_OSS_ERROR from the returned error and see asn1code.h for details on the error.
E_INVALIDARG One or more arguments are invalid.
E_OUTOFMEMORY Ran out of memory.
ERROR_MORE_DATA The specified is not large enough to hold the returned data.
Propagated errors that may be encountered: An error can be propagated from:
CryptMsgCountersignEncoded.

Example

See Example Code For Countersigning a Message.

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
  Windows: Requires Windows 98 (or Windows 95 with IE 3.02 or later).
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.

See Also

CryptMsgCountersignEncoded, CryptMsgVerifyCountersignatureEncoded