Aravinda babu wrote:
> Hi all,
>
> I am new to OpenSSL.I want to get the peer certificate in a memory buffer.
>
> If i use SSL_get_peer_certificate i can get in X509 strcture.
> But i want the peer certificate as a data buffer.(unsigned char *)


Then what are you going to do with it?
Write to a file or memory?
Do you want der or pem encoding?

bp = BIO_new(BIO_s_mem()); /* To memory */
or
bp = BIO_new(BIO_s_file()); /* to a file */
fp = fopen(filename,"w"));
BIO_set_fp(bp,fp,BIO_NOCLOSE);

peer = s->session->peer;

i2d_X509_bio(bp,peer); /* as der */
or
PEM_write_bio_X509(bp,peer); /* as pem */



>
> Is there any API for this ??
>
> Thanks in advance,
> Aravind.


--

Douglas E. Engert
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majordomo@openssl.org