SignerInfo.ComputeCounterSignature Method

Definition

Creates a countersignature and adds the signature to the CMS/PKCS #7 message.

Overloads

ComputeCounterSignature()
Obsolete.

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

ComputeCounterSignature(CmsSigner)

The ComputeCounterSignature(CmsSigner) method creates a countersignature by using the specified signer and adds the signature to the CMS/PKCS #7 message. Countersignatures are restricted to one level.

ComputeCounterSignature()

Source:
SignerInfo.cs
Source:
SignerInfo.cs
Source:
SignerInfo.cs
Source:
SignerInfo.cs

Caution

ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.

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

public:
 void ComputeCounterSignature();
public void ComputeCounterSignature ();
[System.Obsolete("ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.", DiagnosticId="SYSLIB0035", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public void ComputeCounterSignature ();
member this.ComputeCounterSignature : unit -> unit
[<System.Obsolete("ComputeCounterSignature without specifying a CmsSigner is obsolete and is not supported. Use the overload that accepts a CmsSigner.", DiagnosticId="SYSLIB0035", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.ComputeCounterSignature : unit -> unit
Public Sub ComputeCounterSignature ()
Attributes

Exceptions

A null reference was passed to a method that does not accept it as a valid argument.

A cryptographic operation could not be completed.

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.

The following permissions are required to display the user interface on .NET Framework:

The following permissions are required to access the signature key on .NET Framework:

Applies to

ComputeCounterSignature(CmsSigner)

Source:
SignerInfo.cs
Source:
SignerInfo.cs
Source:
SignerInfo.cs
Source:
SignerInfo.cs

The ComputeCounterSignature(CmsSigner) method creates a countersignature by using the specified signer and adds the signature to the CMS/PKCS #7 message. Countersignatures are restricted to one level.

public:
 void ComputeCounterSignature(System::Security::Cryptography::Pkcs::CmsSigner ^ signer);
public void ComputeCounterSignature (System.Security.Cryptography.Pkcs.CmsSigner signer);
member this.ComputeCounterSignature : System.Security.Cryptography.Pkcs.CmsSigner -> unit
Public Sub ComputeCounterSignature (signer As CmsSigner)

Parameters

signer
CmsSigner

A CmsSigner object that represents the counter signer.

Exceptions

A null reference was passed to a method that does not accept it as a valid argument.

A cryptographic operation could not be completed.

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.

The following permissions are required to access the signature key on .NET Framework:

Applies to