openssl - Support both SSL and non-SSL on the same server port -


I plan to add encryption to my server / client communication using OpenSSL but I want to select user Whether or not they want to use the SSL channel, the simplest way is to just create 2 sockets and bind them in a separate port, but I want the server to serve the service only on one port.

Is there no way to open the server side SSL socket, which supports both SSL and non-SSL communication related to the incoming connection to the client?

PS I use OpenSSL Lib for my C ++ code.

A TLS client is a standard format in Hello. You can see some bytes before the first message, Know whether it is a TLS client or not, and respond accordingly.

On port X, there will be an alternative solution for adding unencrypted service, and set stunnel to listen on port Y, where it handles the TLS layer, and will forward plain text to local port X . Although it will be connected to two ports, your service only runs once.

Comments