CmsSigner Constructors

Definition

Initializes a new instance of the CmsSigner class.

Overloads

Name Description
CmsSigner()

Initializes a new instance of the CmsSigner class with default values.

CmsSigner(CspParameters)

Initializes a new instance of the CmsSigner class from a persisted key.

CmsSigner(SubjectIdentifierType)

Initializes a new instance of the CmsSigner class with a specified subject identifier type.

CmsSigner(X509Certificate2)

Initializes a new instance of the CmsSigner class with a specified signer certificate.

CmsSigner(SubjectIdentifierType, X509Certificate2)

Initializes a new instance of the CmsSigner class with a specified signer certificate and subject identifier type.

CmsSigner()

Initializes a new instance of the CmsSigner class with default values.

public:
 CmsSigner();
public CmsSigner();
Public Sub New ()

Remarks

This constructor results in the following default property values:

Property Default value
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

Applies to

CmsSigner(CspParameters)

Initializes a new instance of the CmsSigner class from a persisted key.

public:
 CmsSigner(System::Security::Cryptography::CspParameters ^ parameters);
public CmsSigner(System.Security.Cryptography.CspParameters parameters);
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.CspParameters -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (parameters As CspParameters)

Parameters

parameters
CspParameters

The CSP parameters to describe which signing key to use.

Exceptions

.NET Core and .NET 5+ only: In all cases.

Remarks

This constructor results in the following default property values:

Property Default value
SignerIdentifierType SubjectIdentifierType.SubjectKeyIdentifier
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None

Important

This method is only supported on .NET Framework. Its use on .NET Core throws a PlatformNotSupportedException.

Applies to

CmsSigner(SubjectIdentifierType)

Initializes a new instance of the CmsSigner class with a specified subject identifier type.

public:
 CmsSigner(System::Security::Cryptography::Pkcs::SubjectIdentifierType signerIdentifierType);
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType);
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (signerIdentifierType As SubjectIdentifierType)

Parameters

signerIdentifierType
SubjectIdentifierType

The scheme to use for identifying which signing certificate was used.

Remarks

This constructor results in the following default property values:

Property Default value
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None if SignerIdentifierType is SubjectIdentifierType.NoSignature,

X509IncludeOption.ExcludeRoot otherwise

Applies to

CmsSigner(X509Certificate2)

Initializes a new instance of the CmsSigner class with a specified signer certificate.

public:
 CmsSigner(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate);
public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.X509Certificates.X509Certificate2 -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (certificate As X509Certificate2)

Parameters

certificate
X509Certificate2

The certificate whose private key will be used to sign a message.

Remarks

This constructor results in the following default property values:

Property Default value
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

The signing certificate specified by the certificate parameter is not checked for validity on input. To validate the certificate prior to supplying it to this constructor, use the X509Chain.Build method.

Applies to

CmsSigner(SubjectIdentifierType, X509Certificate2)

Initializes a new instance of the CmsSigner class with a specified signer certificate and subject identifier type.

public:
 CmsSigner(System::Security::Cryptography::Pkcs::SubjectIdentifierType signerIdentifierType, System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate);
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (signerIdentifierType As SubjectIdentifierType, certificate As X509Certificate2)

Parameters

signerIdentifierType
SubjectIdentifierType

The scheme to use for identifying which signing certificate was used.

certificate
X509Certificate2

The certificate whose private key will be used to sign a message.

Remarks

This constructor results in the following default property values:

Property Default value
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None if SignerIdentifierType is SubjectIdentifierType.NoSignature,

X509IncludeOption.ExcludeRoot otherwise

The signing certificate specified by the certificate parameter is not checked for validity on input. To validate the certificate prior to supplying it to this constructor, use the X509Chain.Build method.

Applies to