RSACertificateExtensions.CopyWithPrivateKey(X509Certificate2, RSA) Método

Definición

Combina una clave privada con la clave pública de un certificado RSA para generar un nuevo certificado 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

Parámetros

certificate
X509Certificate2

Certificado RSA.

privateKey
RSA

Clave privada de RSA.

Devoluciones

X509Certificate2

Nuevo certificado RSA con la propiedad HasPrivateKey establecida en true. El objeto de certificado RSA de entrada no se modifica.

Excepciones

certificate o privateKey es null.

El certificado ya tiene asociada una clave privada.

El certificado no tiene ninguna clave pública.

O bien

La clave privada especificada no coincide con la clave pública del certificado especificado.

Se aplica a