2012/2/16 Iñaki Baz Castillo <[email protected]>: > However I've already got it: > > X509 *client_X509; > unsigned char client_PEM_string[10*1024]; > size_t client_PEM_string_len = sizeof(client_PEM_string); > BIO *bio; > int res; > > if ((client_X509 = SSL_get_peer_certificate(ctx))) { > bio = BIO_new (BIO_s_mem()); > res = PEM_write_bio_X509(bio, client_X509); > res = BIO_read(bio, client_PEM_string, (int)client_PEM_string_len); > client_PEM_string[res]='\0'; > X509_free(client_X509); > printf("CERT:\n%s\n", client_PEM_string); > }
Now I've realized that in case the client presents a chain of public certificates (rather than a single certificate) the function SSL_get_peer_certificate (or maybe the functions PEM_write_bio_X509 or BIO_read) just takes the first certificate in the chain. How could I get all the certificates in the chain together? I've found: STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); but I don't find the STACK_OF(X509) definition so I don't know what it is. Thanks for any help. -- Iñaki Baz Castillo <[email protected]> ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [email protected] Automated List Manager [email protected]
