Share via


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

來源:
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(CspParameters)

來源:
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

重要

只有 .NET Framework 才支援這個方法。 它在 .NET Core 上使用會擲回 PlatformNotSupportedException

適用於

CmsSigner(SubjectIdentifierType)

來源:
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如果 為 ,則SignerIdentifierTypeSubjectIdentifierType.NoSignature

X509IncludeOption.ExcludeRoot 否則

適用於

CmsSigner(X509Certificate2)

來源:
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, X509Certificate2)

來源:
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如果 為 ,則SignerIdentifierTypeSubjectIdentifierType.NoSignature

X509IncludeOption.ExcludeRoot 否則

參數指定的 certificate 簽署憑證不會檢查輸入是否有效。 若要在提供憑證給這個建構函式之前驗證憑證,請使用 X509Chain.Build 方法。

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm)

來源:
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如果 為 ,則SignerIdentifierTypeSubjectIdentifierType.NoSignature

X509IncludeOption.ExcludeRoot 否則

參數指定的 certificate 簽署憑證不會檢查輸入是否有效。 若要在提供憑證給這個建構函式之前驗證憑證,請使用 X509Chain.Build 方法。

這個建構函式不會驗證 privateKey 參數是否對應至 中的 certificate公鑰。 如果金鑰不相符,類別 SignedCmsComputeCounterSignature(CmsSigner) 方法會在簽署程式期間擲回 CryptographicException

適用於

CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)

來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
CmsSigner.cs
來源:
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 簽章填補。

適用於