X509Certificate2.CopyWithPrivateKey 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。
重载
| 名称 | 说明 |
|---|---|
| CopyWithPrivateKey(SlhDsa) |
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。 |
| CopyWithPrivateKey(MLDsa) |
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。 |
| CopyWithPrivateKey(MLKem) |
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。 |
| CopyWithPrivateKey(CompositeMLDsa) |
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。 |
| CopyWithPrivateKey(ECDiffieHellman) |
将私钥与证书的 ECDiffieHellman 公钥组合在一起,以生成新的 ECDiffieHellman 证书。 |
CopyWithPrivateKey(SlhDsa)
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。
public:
System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::SlhDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.SlhDsa privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.CopyWithPrivateKey : System.Security.Cryptography.SlhDsa -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Function CopyWithPrivateKey (privateKey As SlhDsa) As X509Certificate2
参数
- privateKey
- SlhDsa
与此证书中的 SLH-DSA 公钥相对应的 SLH-DSA 私钥。
返回
属性 HasPrivateKey 设置为 true的新证书。
当前证书未修改。
- 属性
例外
privateKey 是 null。
指定的私钥与此证书的公钥不匹配。
证书已具有关联的私钥。
适用于
CopyWithPrivateKey(MLDsa)
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。
public:
System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::MLDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.MLDsa privateKey);
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.MLDsa privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.CopyWithPrivateKey : System.Security.Cryptography.MLDsa -> System.Security.Cryptography.X509Certificates.X509Certificate2
member this.CopyWithPrivateKey : System.Security.Cryptography.MLDsa -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Function CopyWithPrivateKey (privateKey As MLDsa) As X509Certificate2
参数
- privateKey
- MLDsa
与此证书中的 ML-DSA 公钥相对应的 ML-DSA 私钥。
返回
属性 HasPrivateKey 设置为 true的新证书。
当前证书未修改。
- 属性
例外
privateKey 是 null。
指定的私钥与此证书的公钥不匹配。
证书已具有关联的私钥。
适用于
CopyWithPrivateKey(MLKem)
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。
public:
System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::MLKem ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.MLKem privateKey);
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.MLKem privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.CopyWithPrivateKey : System.Security.Cryptography.MLKem -> System.Security.Cryptography.X509Certificates.X509Certificate2
member this.CopyWithPrivateKey : System.Security.Cryptography.MLKem -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Function CopyWithPrivateKey (privateKey As MLKem) As X509Certificate2
参数
- privateKey
- MLKem
与此证书中的 ML-KEM 公钥相对应的 ML-KEM 私钥。
返回
属性 HasPrivateKey 设置为 true的新证书。
当前证书未修改。
- 属性
例外
privateKey 是 null。
指定的私钥与此证书的公钥不匹配。
证书已具有关联的私钥。
适用于
CopyWithPrivateKey(CompositeMLDsa)
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
将私钥与包含关联公钥的证书合并到可访问私钥的新实例中。
public:
System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::CompositeMLDsa ^ privateKey);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.CompositeMLDsa privateKey);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.CopyWithPrivateKey : System.Security.Cryptography.CompositeMLDsa -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Function CopyWithPrivateKey (privateKey As CompositeMLDsa) As X509Certificate2
参数
- privateKey
- CompositeMLDsa
与此证书中的复合 ML-DSA 公钥相对应的复合 ML-DSA 私钥。
返回
属性 HasPrivateKey 设置为 true的新证书。
当前证书未修改。
- 属性
例外
privateKey 是 null。
指定的私钥与此证书的公钥不匹配。
证书已具有关联的私钥。
此平台上不支持组合证书和复合 ML-DSA 私钥。
适用于
CopyWithPrivateKey(ECDiffieHellman)
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
- Source:
- X509Certificate2.cs
将私钥与证书的 ECDiffieHellman 公钥组合在一起,以生成新的 ECDiffieHellman 证书。
public:
System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::ECDiffieHellman ^ privateKey);
public System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey(System.Security.Cryptography.ECDiffieHellman privateKey);
member this.CopyWithPrivateKey : System.Security.Cryptography.ECDiffieHellman -> System.Security.Cryptography.X509Certificates.X509Certificate2
Public Function CopyWithPrivateKey (privateKey As ECDiffieHellman) As X509Certificate2
参数
- privateKey
- ECDiffieHellman
私有 ECDiffieHellman 密钥。
返回
一个新的 ECDiffieHellman 证书, HasPrivateKey 其属性设置为 true.
当前证书未修改。
例外
privateKey 是 null。
证书已具有关联的私钥。