On Tue, Jun 01, 2010, Dallas Clement wrote:

> Hi,
> 
> Would someone kindly tutor me on how to print out a certificate
> programmatically?  I know how to extract the common name, but was just
> wondering if there is an API function to just print the whole thing in
> human readable form?
> 
>    X509 *pX509Peer = SSL_get_peer_certificate( pSsl );
>    if ( pX509Peer != 0 )
>    {
>       // Extract the common name from the peer's certificate
>       X509_NAME_get_text_by_NID( X509_get_subject_name( pX509Peer ),
>                                  NID_commonName, commonName,
> commonNameBufferSize );
> 

X509_print_ex() is the best function to use.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to