On 29/06/2016 10:46, Oz wrote: > I have a running program, the program is written in C > I want to convert it from connecting to an HTTP to HTTPS (SSL) > > I have an event for write/read/timeout/error and such > > How do I continue and use the current sockets FD I have, but using openSSL > over it? the most easy and simple way? > > I have created a CTX object, and an SSL object over it (SSL_new(..)) > > I thought about using BIO_new_socket, but having problems with the > connection/ hand shake and reading/writing data (I am the client code only) Try BIO_new_socket + BIO_set_fd Then do the standard OpenSSL socket loop that repeatedly checks if OpenSSL wants you to wait for socket send ready, socket receive ready, data from application ready or data to application ready, then proceeds accordingly (There is an example in apps/s_client.c, but it is difficult to read and contains optional stuff you won't need in your app). I think there is a better example somewhere. Enjoy Jakob -- Jakob Bohm, CIO, Partner, WiseMo A/S. https://www.wisemo.com Transformervej 29, 2860 S?borg, Denmark. Direct +45 31 13 16 10 This public discussion message is non-binding and may contain errors. WiseMo - Remote Service Management for PCs, Phones and Embedded