System.Security.Cryptography.Pkcs.SignerInfo.ComputeCounterSignature Method

The SignerInfo.ComputeCounterSignature method prompts the user to select a signing certificate, creates a countersignature, and adds the signature to the CMS/PKCS #7 message. Countersignatures are restricted to one level.

Syntax

public void ComputeCounterSignature ()

Remarks

This implementation of CMS/PKCS #7 supports only one level of countersignature. That is, a signature can be signed, which forms a countersignature, but that countersignature cannot be signed again.

This method displays a user interface in which you choose signers for this message. This requires that the current process is running in user interactive mode, meaning that the Environment.UserInteractive property is set to true. A process is normally in user interactive mode unless it is a service process or running inside a Web application.

Signers whose certificates meet the following conditions will be displayed in the list:

  • The certificate has an associated private key.

  • The certificate is within its validity period.

  • The certificate has no key usage or a key usage that supports digital signatures or nonrepudiation.

Signer certificates are chosen from the My store.

.NET Framework Security

The following permissions are required to display the user interface:

The following permissions are required to access the signature key:

Requirements

Namespace: System.Security.Cryptography.Pkcs
Assembly: System.Security (in System.Security.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0