0
Reply

x509 certificate subject name in .net 2.0

phani_va

phani_va

Apr 18 2006 3:23 PM
4.7k

Hi,

   I was using crypto API (c++) to load certifcates from registry. To get the subject name of the certificate I used CertNameToStr method with CERT_SIMPLE_NAME_STR flag. This gave me the subject name in the following format
myserver, myunit,mycompany,city,state, US.

With dotnet 2.0 for the same certificate When I call X509Certificate2.SubjectName
I get it in the following format
CN=myserver, OU=myunit, O=mycompany, L=city, S=state, C=US

With 2.0 how can I get the subject name of certificate in the first format rather than the name = value pairs as in the second format. I tried with different flags, but they did not give me the subject name in the format I desired.

Is it possible to do this without using any unmanaged libraries.

I hope I was clear. Let me know if I have to provide further information.
Thanks for the help