Hi, Arjun, For non-blocking case, you have to handle SSL_ERROR_WANT_READ and SSL_ERROR_WANT_WRITE In that case you need to redo *SSL_connect.* * * Huaqing
On Tue, Nov 15, 2011 at 5:51 AM, Arjun SM <arjun...@gmail.com> wrote: > Hi all, > I am newbie to openssl any help is greatly appreciated. > > I have a requirement of fetching the Common name (domin name ) from the > certificate that I request from any HTTPS websites. I followed the regular > method of > > 1. establish a connection with the ip address using *connect() *system > call. > 2. Use *SSL_connect()* system call to perform handshake. > 3. Use *SSL_get_peer_certificate()* to get the certificate. > > The problem I faced was that, the connect() call would at times return a > errno 4 (EINTR) error . So i changed code from blocking to non-blocking > sockets and used select() call to have a valid connection and return an > appropriate file descriptor. > Now the ssl_connect() call returns SSL_ERROR_WANT_READ > or SSL_ERROR_WANT_WRITE error. I am unable to make my code work by adding a > select() even on ssl_connect() call. > > If any one can please help as to how I need to use the ssl_connect() by > polling that would be of great help. preferred language would be C/C++ > > thanks, > ~Arjun > > > > > -- Thank you. Best Regards, Michael(Huaqing) Wang