Alex Rivera | Logout

Exporting X.509 certificate WITHOUT private key

Asked 2009-05-21T16:15:27.457
13

I thought this would be straightforward but apparently it isn't. I have a certificate installed that has a private key, exportable, and I want to programmatically export it with the public key ONLY. In other words, I want a result equivalent to selecting "Do not export the private key" when exporting through certmgr and exporting to .CER.

It seems that all of the X509Certificate2.Export methods will export the private key if it exists, as PKCS #12, which is the opposite of what I want.

Is there any way using C# to accomplish this, or do I need to start digging into CAPICOM?

Edit
Report

1 Answer

1

There is an OpenSSL .NET wrapper you may find useful.

answered 2009-05-21T16:29:28.117

Your Answer