Sorry for my unclear question.
I would like to know if I have gotten the X509_NAME
object,
how can I get the DN in ASN.1 format?
That is to say, I would like to get the DN not like
the readable string "C=US,O=XXX,OU=......", but in ASN.1 encoded
format.
BTW, I have just found the i2d_X509_NAME function,
can I use it?
If I can, is there any extra process should I do to
get the ASN1-formated DN?
Thanks for your time,
wjw
----- Original Message -----
Sent: Thursday, July 10, 2003 6:05
PM
Subject: Re: about getting DN in ASN.1
format
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]
|