tags:

views:

36

answers:

1

Hi, I need Mosquitto http://mosquitto.org to work with SSL. I've read several examples with OpenSSL, but as I've never worked with sockets in C, can someone tell me what do I have to change for my existing sockets? (Accept, write, read?)

Thank you very much

A: 

My understanding is that after you've called accept(), you then have to configure the socket for use with OpenSSL - assuming you've also already configured the library for use as well.

After that, you can use SSL_read() and SSL_write() instead of read() and write().

When you want to close the socket, you need to disable SSL support before calling close().

It's a reasonable undertaking for certain - the socket code isn't really the problem, it's understanding what you need to do to start and stop the TLS support and ensuring that you don't miss something out which could lead to vulnerabilities.

ralight
Thanks for this clear explanation. I'm finally using stunnel to get things work but I could have to edit the program nonetheless.
SuperAllumette