Uredi

Deli z drugimi prek


CmsSigner Constructors

Definition

Initializes a new instance of the CmsSigner class.

Overloads

CmsSigner()

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

CmsSigner(CspParameters)
Obsolete.

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(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

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

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

Initializes a new instance of the CmsSigner class with a specified signer certificate, subject identifier type, private key object, and RSA signature padding.

CmsSigner()

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

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)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

Caution

CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.

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

public:
 CmsSigner(System::Security::Cryptography::CspParameters ^ parameters);
[System.Obsolete("CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.", DiagnosticId="SYSLIB0034", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public CmsSigner (System.Security.Cryptography.CspParameters parameters);
public CmsSigner (System.Security.Cryptography.CspParameters parameters);
[<System.Obsolete("CmsSigner(CspParameters) is obsolete and is not supported. Use an alternative constructor instead.", DiagnosticId="SYSLIB0034", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.CspParameters -> System.Security.Cryptography.Pkcs.CmsSigner
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.

Attributes

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)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

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)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

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);
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)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

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);
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

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

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

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

Parameters

signerIdentifierType
SubjectIdentifierType

One of the enumeration values that specifies 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.

privateKey
AsymmetricAlgorithm

The private key object to use when signing the 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.

This constructor does not validate that the privateKey parameter corresponds to the public key in certificate. If the keys don't match, the SignedCms class and ComputeCounterSignature(CmsSigner) method throw a CryptographicException during the signing process.

Applies to

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs
Source:
CmsSigner.cs

Initializes a new instance of the CmsSigner class with a specified signer certificate, subject identifier type, private key object, and RSA signature padding.

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

Parameters

signerIdentifierType
SubjectIdentifierType

One of the enumeration values that specifies 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.

privateKey
RSA

The private key object to use when signing the message.

signaturePadding
RSASignaturePadding

The RSA signature padding to use.

Applies to