SSL_get_peer_certificate() failing

2008-07-28 Thread M
Hi, I am having a problem establishing a connection with openssl libs. My client code is failing because SSL_get_peer_certificate() returns NULL. On the server code SSL_get_error() returns 1 and the error string i get is "error::lib(0):func(0):reason(0)" which is very unclear to me. Why

Re: SSL_get_peer_certificate() failing

2008-07-28 Thread Kyle Hamilton
DESCRIPTION SSL_get_peer_certificate() returns a pointer to the X509 certificate the peer presented. If the peer did not present a certificate, NULL is returned. Please see the manual page for SSL_get_peer_certificate for more information (including information on how to tell

Re: SSL_get_peer_certificate() failing

2008-07-28 Thread M
Thanks, I've read the man page for SSL_get_peer_certificate() and it says it returns NULL if " No certificate was presented by the peer or no connection was established." After tracing through the code I see that SSL_get_peer_certificate() returns null because no connection has been established

Re: SSL_get_peer_certificate() failing

2008-07-28 Thread Kyle Hamilton
How do you know that s isn't null? Have you actually called SSL_CTX_set_verify or SSL_set_verify? Without that being called, there is no request for the certificate from the client. How do you know the client is sending the certificate? Can you still send data across the link? Or is it torn do

Re: SSL_get_peer_certificate() failing

2008-07-29 Thread M
I know that s isn't null because I check its value before I call SSL_get_peer_certificate(). I've also verified that s->session is infact NULL before the call to SSL_get_peer_certificate(). I can still send data across the link - I've tested using BIO_read() and BIO_write() to see if the machi

Re: SSL_get_peer_certificate() failing

2008-07-30 Thread Lutz Jaenicke
>From the mail thread I take it that your problem is visible at the client side of the connection, so a server certificate should always be send as long as you are not using an anonymous cipher (which need to be enabled specifically). Are you using SSL_connect() to explicitly connect to the server?