Posts

Showing posts with the label RSA

How to retrieve the private key of a certificate?

private string PrivateKey(X509Certificate2 certificate) { string pk; if (certificate.PrivateKey != null) { RSACryptoServiceProvider rsaProvider = certificate.PrivateKey as RSACryptoServiceProvider; pk = rsaProvider.CspKeyContainerInfo.UniqueKeyContainerName; } return pk; }