CmsSigner 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 CmsSigner 类的新实例。
重载
| 名称 | 说明 |
|---|---|
| CmsSigner() |
使用默认值初始化类的新实例 CmsSigner 。 |
| CmsSigner(SubjectIdentifierType, X509Certificate2, SlhDsa) | |
| CmsSigner(SubjectIdentifierType, X509Certificate2, MLDsa) | |
| CmsSigner(SubjectIdentifierType, X509Certificate2, CompositeMLDsa) | |
| CmsSigner(SubjectIdentifierType, X509Certificate2, AsymmetricAlgorithm) |
使用指定的签名者证书、使用者标识符类型和私钥对象初始化类的新实例 CmsSigner 。 |
| CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding) |
使用指定的签名者证书、使用者标识符类型、私钥对象和 RSA 签名填充初始化 CmsSigner 类的新实例。 |
| CmsSigner(X509Certificate2) |
使用指定的签名者证书初始化类的新实例 CmsSigner 。 |
| CmsSigner(SubjectIdentifierType) |
使用指定的使用者标识符类型初始化类的新实例 CmsSigner 。 |
| CmsSigner(CspParameters) |
已过时.
从持久化键初始化类的新实例 CmsSigner 。 |
| CmsSigner(SubjectIdentifierType, X509Certificate2) |
使用指定的签名者证书和使用者标识符类型初始化类的新实例 CmsSigner 。 |
CmsSigner()
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- 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)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- 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)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- 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)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- 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)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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
签名消息时要使用的私钥对象。
注解
此构造函数生成以下默认属性值:
| 财产 | 默认值 |
|---|---|
| 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) 方法会在签名过程中引发 CryptographicException 。
适用于
CmsSigner(SubjectIdentifierType, X509Certificate2, RSA, RSASignaturePadding)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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 签名填充。
适用于
CmsSigner(X509Certificate2)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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
私钥将用于对消息进行签名的证书。
注解
此构造函数生成以下默认属性值:
| 财产 | 默认值 |
|---|---|
| SignerIdentifierType | SubjectIdentifierType.IssuerAndSerialNumber |
| DigestAlgorithm | 2.16.840.1.101.3.4.2.1 (SHA-256) |
| IncludeOption | X509IncludeOption.ExcludeRoot |
参数指定的 certificate 签名证书未在输入时检查有效性。 若要在向此构造函数提供证书之前验证证书,请使用 X509Chain.Build 该方法。
适用于
CmsSigner(SubjectIdentifierType)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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
用于标识使用哪个签名证书的方案。
注解
此构造函数生成以下默认属性值:
| 财产 | 默认值 |
|---|---|
| DigestAlgorithm | 2.16.840.1.101.3.4.2.1 (SHA-256) |
| IncludeOption |
X509IncludeOption.None如果为 SignerIdentifierType,则为SubjectIdentifierType.NoSignature X509IncludeOption.ExcludeRoot 否则 |
适用于
CmsSigner(CspParameters)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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+ :在所有情况下。
注解
此构造函数生成以下默认属性值:
| 财产 | 默认值 |
|---|---|
| SignerIdentifierType | SubjectIdentifierType.SubjectKeyIdentifier |
| DigestAlgorithm | 2.16.840.1.101.3.4.2.1 (SHA-256) |
| IncludeOption | X509IncludeOption.None |
Important
此方法仅在 .NET Framework 上受支持。 它在 .NET Core 上使用时会抛出一个 PlatformNotSupportedException。
适用于
CmsSigner(SubjectIdentifierType, X509Certificate2)
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- Source:
- CmsSigner.cs
- 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
私钥将用于对消息进行签名的证书。
注解
此构造函数生成以下默认属性值:
| 财产 | 默认值 |
|---|---|
| DigestAlgorithm | 2.16.840.1.101.3.4.2.1 (SHA-256) |
| IncludeOption |
X509IncludeOption.None如果为 SignerIdentifierType,则为SubjectIdentifierType.NoSignature X509IncludeOption.ExcludeRoot 否则 |
参数指定的 certificate 签名证书未在输入时检查有效性。 若要在向此构造函数提供证书之前验证证书,请使用 X509Chain.Build 该方法。