I'm trying to connect to a server (written in Golang) using Boost Asio. I can connect and read/write fine unencrypted, but I can't seem to get SSL support to work. Basically, whenever I attempt a handshake I receive a "wrong version number".
Here's a snippet that shows how I'm trying to set it up. I'm not trying to perform any verification, just get the connection going. At this point in the code, the client has connected to the server and swapped some unencrypted commands.
boost::asio::ssl::context ctx(*ios, boost::asio::ssl::context::tlsv12_client); //also tried sslv23, etc
ctx.set_verify_mode(boost::asio::ssl::context::verify_none);
this->sslSocket = new boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>(*socket, ctx);
this->sslSocket->async_handshake(boost::asio::ssl::stream_base::client,
boost::bind(&MyConnection::handleHandshake, this,
boost::asio::placeholders::error));
&MyConnection::handleHandshake()
receives the result of the handshake.
So questions are:
- Is the above code doing everything it should normally need to do to connect to a server? Am I missing a step?
- Are there server side issues that might be in play? I checked throught the Go code, and it does look to support TLS 1.0/1.1/1.2 as well as SSL 2 & 3