ECDsaCertificateExtensions.CopyWithPrivateKey(X509Certificate2, ECDsa) 方法

定义

将私钥与 ECDsa 证书的公钥合并,以生成新的 ECDSA 证书。

public:
[System::Runtime::CompilerServices::Extension]
 static System::Security::Cryptography::X509Certificates::X509Certificate2 ^ CopyWithPrivateKey(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate, System::Security::Cryptography::ECDsa ^ privateKey);
public static System.Security.Cryptography.X509Certificates.X509Certificate2 CopyWithPrivateKey (this System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, System.Security.Cryptography.ECDsa privateKey);
static member CopyWithPrivateKey : System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.ECDsa -> System.Security.Cryptography.X509Certificates.X509Certificate2
<Extension()>
Public Function CopyWithPrivateKey (certificate As X509Certificate2, privateKey As ECDsa) As X509Certificate2

参数

certificate
X509Certificate2

ECDSA 证书。

privateKey
ECDsa

私有 ECDSA 密钥。

返回

新 ECDSA 证书,其 HasPrivateKey 属性设置为 true。 未修改输入 ECDSA 证书对象。

例外

certificateprivateKeynull

该证书已有关联的私钥。

该证书没有公钥。

- 或 -

指定私钥与指定证书的公钥不匹配。

适用于