0

PKCS12 certificate is stored in binary format while PEM certificate is an ASCII file which can be opened and viewed in a text editor.

Q1. How can I convert a PEM ceritificate of the form below to a PKCS12 certificate programmatically?

-----BEGIN CERTIFICATE----- 
*****CERTIFICATE DATA*****
-----END CERTIFICATE-----

-----BEGIN RSA PRIVATE KEY----- 
*****PRIVATE KEY DATA******** 
-----END RSA PRIVATE KEY-----

Q2. Now I have read a PKCS12 file and I want to convert the PKCS12 data into a PEM format, again using a .NET program?

Do I need to use any of the encoding schemes supported in .NET?

Note: I am using CryptoAPI library

pankajt
  • 7,642
  • 12
  • 39
  • 60

1 Answers1

0

I believe the Mentalis.org Security Library can do this. I think they have an example that covers what you want to do; look for the Cert2PFX project in the download.

R Ubben
  • 2,225
  • 16
  • 8