4

I have been able to OpenSSL tools to extract the certificate and private key bytes from an existing PFX (PKCS12) file.

However, I wish to do this using .NET. I am able to use the X509Certificate classes to load a PFX file and extract the certificate bytes but, I do not know how to extract the private key. The certificate (exported as a PFX file) was created using a sha1RSA aignature algorithm.

I know RSA classes exist in .NET but I do not know how to use them together.

Any advice will help.

Thanks in advance.

Subbu

Subbu
  • 839
  • 2
  • 12
  • 34

1 Answers1

1

See my answer here: extract private key bytes in C#

Does this work for you?

Community
  • 1
  • 1
Andrew Savinykh
  • 25,351
  • 17
  • 103
  • 158
  • Yes. This helps. Thank you. I did try out the PemWriter today but was passing on the AsymmetricKeyParameter class which the PemWriter did not convert even after I casted it. – Subbu Jun 07 '11 at 05:06