語言

CmsSigner 建構函式

定義

初始化 CmsSigner 類別的新執行個體。

多載

名稱 Description
CmsSigner()

初始化一個以預設值的新類別實例 CmsSigner 。

CmsSigner(SubjectIdentifierType, X509Certificate2, SlhDsa)
CmsSigner(SubjectIdentifierType, X509Certificate2, MLDsa)
CmsSigner(SubjectIdentifierType, X509Certificate2, CompositeMLDsa)
CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

初始化一個新的類別實例 CmsSigner ,並以指定的簽署者憑證、主體識別碼類型及私鑰物件。

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

初始化一個新的 CmsSigner 類別實例,並設定指定的簽署者憑證、主體識別碼類型、私鑰物件及 RSA 簽章填充。

CmsSigner(X509Certificate2)

初始化一個帶有指定簽署者憑證的新 CmsSigner 類別實例。

CmsSigner(SubjectIdentifierType)

初始化一個具有指定主體識別型別的類別新實例 CmsSigner 。

CmsSigner(CspParameters)
已淘汰.

從持久化的鍵初始化該類別的新實例 CmsSigner 。

CmsSigner(SubjectIdentifierType, X509Certificate2)

初始化一個新的類別實例 CmsSigner ,並以指定的簽署者憑證和主題識別碼類型。

CmsSigner()

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs

初始化一個以預設值的新類別實例 CmsSigner 。

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

備註

此建構子會產生以下預設屬性值:

房產 預設值
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, SlhDsa)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
public:
 CmsSigner(System::Security::Cryptography::Pkcs::SubjectIdentifierType signerIdentifierType, System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::SlhDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.SlhDsa? privateKey);
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.SlhDsa? privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.SlhDsa -> System.Security.Cryptography.Pkcs.CmsSigner
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.SlhDsa -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (signerIdentifierType As SubjectIdentifierType, certificate As X509Certificate2, privateKey As SlhDsa)

參數

signerIdentifierType
SubjectIdentifierType
certificate
X509Certificate2
privateKey
SlhDsa
屬性

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, MLDsa)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
public:
 CmsSigner(System::Security::Cryptography::Pkcs::SubjectIdentifierType signerIdentifierType, System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::MLDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.MLDsa? privateKey);
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.MLDsa? privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.MLDsa -> System.Security.Cryptography.Pkcs.CmsSigner
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.MLDsa -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (signerIdentifierType As SubjectIdentifierType, certificate As X509Certificate2, privateKey As MLDsa)

參數

signerIdentifierType
SubjectIdentifierType
certificate
X509Certificate2
privateKey
MLDsa
屬性

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, CompositeMLDsa)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
public:
 CmsSigner(System::Security::Cryptography::Pkcs::SubjectIdentifierType signerIdentifierType, System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::CompositeMLDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.CompositeMLDsa? privateKey);
public CmsSigner(System.Security.Cryptography.Pkcs.SubjectIdentifierType signerIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2? certificate, System.Security.Cryptography.CompositeMLDsa? privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.CompositeMLDsa -> System.Security.Cryptography.Pkcs.CmsSigner
new System.Security.Cryptography.Pkcs.CmsSigner : System.Security.Cryptography.Pkcs.SubjectIdentifierType * System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.CompositeMLDsa -> System.Security.Cryptography.Pkcs.CmsSigner
Public Sub New (signerIdentifierType As SubjectIdentifierType, certificate As X509Certificate2, privateKey As CompositeMLDsa)

參數

signerIdentifierType
SubjectIdentifierType
certificate
X509Certificate2
privateKey
CompositeMLDsa
屬性

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

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

簽署訊息時使用的私鑰物件。

備註

此建構子會產生以下預設屬性值:

房產 預設值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None 若 SignerIdentifierType 是 SubjectIdentifierType.NoSignature,

否則為 X509IncludeOption.ExcludeRoot

參數指定的 certificate 簽署憑證不會在輸入時檢查有效性。 若要在提供給此建構者前驗證憑證,請使用該 X509Chain.Build 方法。

此建構器無法驗證該 privateKey 參數是否對應於 中的 certificate公鑰。 如果金鑰不匹配, SignedCms 類別和 ComputeCounterSignature(CmsSigner) 方法會在簽名過程中拋出 a CryptographicException 。

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs

初始化一個新的 CmsSigner 類別實例,並設定指定的簽署者憑證、主體識別碼類型、私鑰物件及 RSA 簽章填充。

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 簽名填充的使用方式。

適用於

CmsSigner(X509Certificate2)

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

該憑證的私鑰將用於簽署訊息。

備註

此建構子會產生以下預設屬性值:

房產 預設值
SignerIdentifierType SubjectIdentifierType.IssuerAndSerialNumber
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.ExcludeRoot

參數指定的 certificate 簽署憑證不會在輸入時檢查有效性。 若要在提供給此建構者前驗證憑證,請使用該 X509Chain.Build 方法。

適用於

CmsSigner(SubjectIdentifierType)

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

用於識別所使用的簽署憑證的方案。

備註

此建構子會產生以下預設屬性值:

房產 預設值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None 若 SignerIdentifierType 是 SubjectIdentifierType.NoSignature,

否則為 X509IncludeOption.ExcludeRoot

適用於

CmsSigner(CspParameters)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
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+:適用於所有情況。

備註

此建構子會產生以下預設屬性值:

房產 預設值
SignerIdentifierType SubjectIdentifierType.SubjectKeyIdentifier
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None

Important

此方法僅支援 .NET 框架。 在.NET核心上使用它會觸發PlatformNotSupportedException。

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2)

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

該憑證的私鑰將用於簽署訊息。

備註

此建構子會產生以下預設屬性值:

房產 預設值
DigestAlgorithm 2.16.840.1.101.3.4.2.1 (SHA-256)
IncludeOption X509IncludeOption.None 若 SignerIdentifierType 是 SubjectIdentifierType.NoSignature,

否則為 X509IncludeOption.ExcludeRoot

參數指定的 certificate 簽署憑證不會在輸入時檢查有效性。 若要在提供給此建構者前驗證憑證,請使用該 X509Chain.Build 方法。

適用於