locked
problem creating X509Certificate2 from .pem cert file RRS feed

  • Question

  • I'm trying to instantiate an X509Certificate2 with the constructor new X509Certificate2("c:\\mycert.pem") but I'm getting a CryptoGraphicException that says "cannot find the requested object".  My cert file is in the PEM format generated by openssl so I'm assuming that the X509Certificate2 class just doesn't know how to work with this format.  Using the openssl utility I was able to convert the cert file to the PKCS12 format and I was then able to instantiate the X509Certificate2 object with a reference to the resulting file. Ideally though, I could work directly with the PEM format.  Does anyone know of a framework class or utility that will allow me to do this?  It would be nice if .net would support this format since PEM is a pretty wide spread standard.
    Thanks
    Tuesday, May 23, 2006 7:07 PM

Answers

  • I found this post which seems to indicate that to get a string fomated to PEM you would use Convert.FromBase64String. Does anyone know if this is in fact the case? Thanks for your help.

    http://pages.infinit.net/ctech/20040812-0816.html
    Tuesday, June 19, 2007 1:39 PM