In message <[EMAIL PROTECTED]> on Thu, 10 Jul 2003 16:24:48 +0900, "Wu Junwei" <[EMAIL PROTECTED]> said:
Wu.Junwei> How can I get the DN of a certificate in ASN.1 format Wu.Junwei> from a X509_NAME object? (I'm starting to believe we need a HOWTO on understanding all those acronyms) What you're writing above is really confusing, so here's my guess at what you meant: 1. you have a certificate. (It's structure is defined in the ASN.1 language by necessity). 2. the certificate is in binary format (DER, which is an encoding format) 3. you need to figure out how to load it in your program. 4. you need to figure out how to get an X509_NAME from the result of the load. If all that is correct, the following (untested!) snipet of code should work: FILE *f = fopen("yourfile","r"); X509 *x509; X509_NAME *x509name; if (f == NULL) { you_error_routine; } x509 = d2i_X509_fp(f, NULL); if (x509 == NULL) { you_error_routine; } x509name = X509_get_subject_name(x509); After that, you can do what you need with x509name. If you need to print it, for example, you can use X509_NAME_print_ex (see the corresponding manual). -- Richard Levitte \ Tunnlandsvägen 3 \ [EMAIL PROTECTED] [EMAIL PROTECTED] \ S-168 36 BROMMA \ T: +46-8-26 52 47 \ SWEDEN \ or +46-708-26 53 44 Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED] Member of the OpenSSL development team: http://www.openssl.org/ Unsolicited commercial email is subject to an archival fee of $400. See <http://www.stacken.kth.se/~levitte/mail/> for more info. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]