共用方式為


RSACertificateExtensions.CopyWithPrivateKey(X509Certificate2, RSA) 方法

定義

結合私密金鑰與 RSA 憑證的公開金鑰,以產生新的 RSA 憑證。

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

參數

certificate
X509Certificate2

RSA 憑證。

privateKey
RSA

私密 RSA 金鑰。

傳回

HasPrivateKey 屬性設為 true 的新 RSA 憑證。 輸入 RSA 憑證物件未修改。

例外狀況

certificateprivateKeynull

憑證已有相關的私密金鑰。

憑證沒有公開金鑰。

-或-

指定的私密金鑰與指定憑證的公開金鑰不相符。

適用於