RE: printing a certificate

2010-06-02 Thread Arunkumar Manickam
Look at openssl-*/apps/x509.c

Arun

-Original Message-
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of Dallas Clement
Sent: Wednesday, June 02, 2010 9:50 AM
To: openssl-users@openssl.org
Subject: printing a certificate

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 );

Thanks,
Dallas
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: printing a certificate

2010-06-02 Thread Dr. Stephen Henson
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 Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


Re: printing a certificate

2010-06-02 Thread Dallas Clement
Thanks gents!

On Wed, Jun 2, 2010 at 6:45 AM, Dr. Stephen Henson st...@openssl.org wrote:
 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-us...@openssl.org
 Automated List Manager                           majord...@openssl.org

__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


printing a certificate

2010-06-01 Thread Dallas Clement
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 );

Thanks,
Dallas
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org