>I need the full subject DN of the certificate, and the DER encoded X509
>certificate itself (and its length).  ie: what you would find in the
>userCertificate field in an LDAP directory.

Use i2d_X509(..) to convert from X509* to DER :

/* Convert certificate from X509* to DER, put it in a string certificate */
   len = i2d_X509(xs, NULL);
   cert = malloc(len);
   buf = cert;
   if (!(i2d_X509(xs, &buf)))

Find the correct NID to get DN in openssl *.h, and use:

X509* xs;

xn = X509_get_subject_name(xs);
X509_NAME_get_text_by_NID(xn, NID_commonName, name, 30);
X509_NAME_get_text_by_NID(xn, NID_pkcs9_emailAddress, mail, 30);

I made a patch to check cert status during client authentication in Apache,
with LDAP directory v2, I send it to the list, if you're interested I'll
send you again.

Andrea

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to