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 WINAPI CryptMsgCountersign( _Inout_ HCRYPTMSG hCryptMsg, _In_ DWORD dwIndex, _In_ DWORD cCountersigners, _In_ PCMSG_SIGNER_ENCODE_INFO rgCountersigners );
Parameters
- hCryptMsg [in, out]
-
Cryptographic message handle to be used.
- dwIndex [in]
-
Zero-based index of the signer in the signed or signed-and-enveloped message to be countersigned.
- cCountersigners [in]
-
Number of countersigners in the rgCountersigners array.
- rgCountersigners [in]
-
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 |
|---|---|
|
One or more arguments are not valid. |
|
Ran out of memory. |
|
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.
Examples
For an example that uses this function, see Example C Program: Encoding and Decoding a Countersigned Message.
Requirements
|
Minimum supported client |
Windows XP [desktop apps | Windows Store apps] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps | Windows Store apps] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Low-level Message Functions
- Simplified Message Functions
- CryptMsgCountersignEncoded
- CryptMsgVerifyCountersignatureEncoded