To get the Common Name, this seems to work: X509* pCert; char buf[256];
int x = X509_NAME_get_text_by_NID( X509_get_subject_name(pCert), NID_commonName, buf, 256); The return value seems to be the number of characters written to the buffer. I'd also be interested if anyone has a code sample for extracting the dNSName from the subjectAltName extension of a certificate. Daryl Odnert [EMAIL PROTECTED] -----Original Message----- From: Shane Titus [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 27, 2002 8:08 PM To: [EMAIL PROTECTED] Subject: extract CN and dNSName If anyone could help me it would be well appreciated. I am trying to extract the Common Name and the dNSName from a certificate. I was attempting this using the X509_get_ext_d2i(x, NID_commonName or NID_subject_alt_name, NULL, NULL);. I can't seem to get it working. Thanks Shane Titus EBS/EBS net Inc. 978.448.9340/6376 (phone/fax) http://www.ebsnetinc.com mailto:[EMAIL PROTECTED] -- Check out our new web browser/html viewer technology. Download a win9x version from: http://www.ebsnetinc.com/browser.html ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]