In message <[EMAIL PROTECTED]> on Thu, 10 Jul 2003 18:25:22 +0900, "Wu Junwei" <[EMAIL PROTECTED]> said:
Wu.Junwei> Sorry for my unclear question. Wu.Junwei> Wu.Junwei> I would like to know if I have gotten the X509_NAME object, Wu.Junwei> how can I get the DN in ASN.1 format? Wu.Junwei> Wu.Junwei> That is to say, I would like to get the DN not like the Wu.Junwei> readable string "C=US,O=XXX,OU=......", but in ASN.1 Wu.Junwei> encoded format. Ah, OK, that was a bit clearer. Wu.Junwei> BTW, I have just found the i2d_X509_NAME function, can I Wu.Junwei> use it? Yes. You use it like this: unsigned char *buf,*pp; X509_NAME x509name; int len; len = i2d_X509_NAME(x509name,NULL); if (len < 0) ERROR; buf = malloc(len); pp = buf; i2d_X509_NAME(x509name,&pp); At this point, buf points at the DER-encoded DN, and len has its length. If all you want to do is write it to file, you can do it quite quickly like this: ASN1_i2d_fp(i2d_X509_NAME,f,(unsignde char *)x509name); NOTE THAT ALL THE CODE ABOVE IS UNTESTED. -- 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]