On Wed, Jan 05, 2000 at 01:32:58PM +0100, Flemming Jans wrote:
> Hi,
>
> Are there any specific funtions for extracting the CN from a certificate
> ?
>
> Or do I have to extract it myself from the X509_get_subject_name()
> buffer ?
#define CCERT_BUFSIZ 256
SSL *con;
X509 *peer;
char peer_CN[CCERT_BUFSIZ];
peer = SSL_get_peer_certificate(con);
if (peer != NULL) {
X509_NAME_get_text_by_NID(X509_get_subject_name(peer),
NID_commonName, peer_CN, CCERT_BUFSIZ);
X509_free(peer);
}
if (SSL_get_verify_result(con) == X509_V_OK)
peer_verified = 1; /* CN has been verified successfully */
else
peer_verified = 0; /* CN given, but could not be verified */
Best regards,
Lutz
--
Lutz Jaenicke [EMAIL PROTECTED]
BTU Cottbus http://www.aet.TU-Cottbus.DE/personen/jaenicke/
Lehrstuhl Allgemeine Elektrotechnik Tel. +49 355 69-4129
Universitaetsplatz 3-4, D-03044 Cottbus Fax. +49 355 69-4153
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]