Прочитај на енглеском Уреди

Делите путем


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
Source:
CmsSigner.cs

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

C#
public CmsSigner();

Remarks

This constructor results in the following default property values:

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CmsSigner(CspParameters)

Source:
CmsSigner.cs
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.

C#
[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);
C#
public CmsSigner(System.Security.Cryptography.CspParameters parameters);

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:

Важно

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

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије (Застарело)
.NET (8 (package-provided), 9 (package-provided), 10 (package-provided))
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5 (6, 7, 8, 9, 10)

CmsSigner(SubjectIdentifierType)

Source:
CmsSigner.cs
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.

C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType);

Parameters

signerIdentifierType
SubjectIdentifierType

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

Remarks

This constructor results in the following default property values:

Applies to

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CmsSigner(X509Certificate2)

Source:
CmsSigner.cs
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.

C#
public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2? certificate);
C#
public CmsSigner(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);

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:

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CmsSigner(SubjectIdentifierType, X509Certificate2)

Source:
CmsSigner.cs
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.

C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate);
C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);

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:

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

Source:
CmsSigner.cs
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.

C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.AsymmetricAlgorithm? privateKey);
C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Security.Cryptography.AsymmetricAlgorithm privateKey);

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:

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

Source:
CmsSigner.cs
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.

C#
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.RSA? privateKey, System.Security.Cryptography.RSASignaturePadding? signaturePadding);

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

.NET 10 (package-provided) и друге верзије
Производ Верзије
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided), 2.1 (package-provided)
Windows Desktop 7, 8, 9, 10