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?
Asked
Active
Viewed 5,660 times
7
-
@Luis, I am struggling with the same at the moment. Did you figure out how to get the private key from a .pvk file? – Rashmi Pandit Feb 10 '15 at 23:04
-
1@RashmiPandit, I forgot completely of checked the correct answer. I just checked. It work's for me. – Luiz Costa Feb 12 '15 at 19:03
3 Answers
4
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.
0
You can use this command to combine them.
pvk2pfx -spc CA.cer -pvk CA.pvk -pfx CA.pfx

Community
- 1
- 1

Muhammad Omar ElShourbagy
- 6,718
- 2
- 32
- 50
0
How about this ?
Have in mind:
Currently this property supports only RSA or DSA keys, so it returns either an RSACryptoServiceProvider or a DSACryptoServiceProvider object. If no private key is associated with the certificate, a null reference (Nothing in Visual Basic) is returned

anthares
- 11,070
- 4
- 41
- 61
-
This doesn't address the question. The link shows how to read the PrivateKey from an X509Cert if it's already present, but not how to load it from a pvk file. – Peter Oct 11 '12 at 02:38