Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read a private key from pvk file in C#?

I have to read a private key, and this key is on pvk format. I use X509Certificate2 class, but i this class i have only public key access. How can I get a private key from pvk file?

like image 702
Luiz Costa Avatar asked Feb 12 '10 18:02

Luiz Costa


1 Answers

Luiz, you need to combine the CER and PVK into a single PFX file, then import the file as a cert so that when you load the X509Cert the PrivateKey will be there. See Decrypt with PrivateKey X.509 Certificate.

like image 122
Peter Avatar answered Oct 05 '22 09:10

Peter