CmsSigner 构造函数

定义

初始化 CmsSigner 类的新实例。

重载

CmsSigner()

使用默认值初始化 CmsSigner 类的新实例。

CmsSigner(CspParameters)
已过时.

基于保留的密钥来初始化 CmsSigner 类的新实例。

CmsSigner(SubjectIdentifierType)

使用指定的使用者标识符类型来初始化 CmsSigner 类的新实例。

CmsSigner(X509Certificate2)

使用指定的签名者证书来初始化 CmsSigner 类的新实例。

CmsSigner(SubjectIdentifierType, X509Certificate2)

使用指定的签名者证书和使用者标识符类型来初始化 CmsSigner 类的新实例。

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

使用指定的签名者证书、使用者标识符类型和私钥对象来初始化 CmsSigner 类的新实例。

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

使用指定的签名者证书、使用者标识符类型、私钥对象和 RSA 签名填充初始化 CmsSigner 类的新实例。

CmsSigner()

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

使用默认值初始化 CmsSigner 类的新实例。

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

注解

此构造函数生成以下默认属性值:

properties 默认值
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

适用于

CmsSigner(CspParameters)

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

注意

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

基于保留的密钥来初始化 CmsSigner 类的新实例。

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
CspParameters

用于描述要使用的签名密钥的 CSP 参数。

属性

例外

仅限 .NET Core 和 .NET 5 及更高版本:在所有情况下。

注解

此构造函数生成以下默认属性值:

properties 默认值
SignerIdentifierType SubjectIdentifierType.SubjectKeyIdentifier
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None

重要

此方法仅在 .NET Framework 上受支持。 它在 .NET Core 上的使用会 PlatformNotSupportedException引发 。

适用于

CmsSigner(SubjectIdentifierType)

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

使用指定的使用者标识符类型来初始化 CmsSigner 类的新实例。

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)

参数

signerIdentifierType
SubjectIdentifierType

用于标识所使用的签名证书的方案。

注解

此构造函数生成以下默认属性值:

properties 默认值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None如果 为 ,则为SignerIdentifierTypeSubjectIdentifierType.NoSignature

否则为 X509IncludeOption.ExcludeRoot

适用于

CmsSigner(X509Certificate2)

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

使用指定的签名者证书来初始化 CmsSigner 类的新实例。

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)

参数

certificate
X509Certificate2

私钥将用于对消息进行签名的证书。

注解

此构造函数生成以下默认属性值:

properties 默认值
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

不会在输入时 certificate 检查参数指定的签名证书的有效性。 若要在将证书提供给此构造函数之前对其进行验证,请使用 X509Chain.Build 方法。

适用于

CmsSigner(SubjectIdentifierType, X509Certificate2)

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

使用指定的签名者证书和使用者标识符类型来初始化 CmsSigner 类的新实例。

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)

参数

signerIdentifierType
SubjectIdentifierType

用于标识所使用的签名证书的方案。

certificate
X509Certificate2

私钥将用于对消息进行签名的证书。

注解

此构造函数生成以下默认属性值:

properties 默认值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None如果 为 ,则为SignerIdentifierTypeSubjectIdentifierType.NoSignature

否则为 X509IncludeOption.ExcludeRoot

不会在输入时 certificate 检查参数指定的签名证书的有效性。 若要在将证书提供给此构造函数之前对其进行验证,请使用 X509Chain.Build 方法。

适用于

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

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

使用指定的签名者证书、使用者标识符类型和私钥对象来初始化 CmsSigner 类的新实例。

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)

参数

signerIdentifierType
SubjectIdentifierType

枚举值之一,指定用于标识所使用的签名证书的方案。

certificate
X509Certificate2

私钥将用于对消息进行签名的证书。

privateKey
AsymmetricAlgorithm

对消息进行签名时要使用的私钥对象。

注解

此构造函数生成以下默认属性值:

properties 默认值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None如果 为 ,则为SignerIdentifierTypeSubjectIdentifierType.NoSignature

否则为 X509IncludeOption.ExcludeRoot

不会在输入时 certificate 检查参数指定的签名证书的有效性。 若要在将证书提供给此构造函数之前对其进行验证,请使用 X509Chain.Build 方法。

此构造函数不验证 参数是否 privateKey 与 中的 certificate公钥对应。 如果密钥不匹配,类和方法会在SignedCms签名过程中引发 CryptographicExceptionComputeCounterSignature(CmsSigner)

适用于

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

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

使用指定的签名者证书、使用者标识符类型、私钥对象和 RSA 签名填充初始化 CmsSigner 类的新实例。

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)

参数

signerIdentifierType
SubjectIdentifierType

枚举值之一,指定用于标识所使用的签名证书的方案。

certificate
X509Certificate2

私钥将用于对消息进行签名的证书。

privateKey
RSA

对消息进行签名时要使用的私钥对象。

signaturePadding
RSASignaturePadding

要使用的 RSA 签名填充。

适用于