Question

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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top