开发者

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. Ho开发者_JAVA技巧w can I get a private key from pvk file?


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.


http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2.privatekey.aspx

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


You can use this command to combine them.

pvk2pfx -spc CA.cer -pvk CA.pvk -pfx CA.pfx

Decrypt with PrivateKey X.509 Certificate

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜