title: Boost Asio Client Can't Connect to server with selfsigned certificate
body: <p>Im trying to connect to a https server using boost asio as part of a Rest API. However, I can get it. The server has a selfsigned certificate. I disable verification, but then in the handshake it says that the &quot;dh key is too small&quot;.</p>
  <p>Here is my code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/asio.hpp&gt;
  #include &lt;boost/bind.hpp&gt;
  #include &lt;boost/lambda/bind.hpp&gt;
  #include &lt;boost/lambda/lambda.hpp&gt;
  #include &lt;boost/asio/ssl.hpp&gt;
  using namespace std;
  using namespace boost;
  
  
  int main(){
      try{
          asio::io_service ioService;
          asio::ssl::context sslContext(asio::ssl::context::sslv23);
          
          
          asio::ip::tcp::resolver resolver(ioService);
          asio::ip::tcp::resolver::query query(&quot;201.175.33.14&quot;, &quot;9005&quot;);
          asio::ip::tcp::resolver::iterator endpointIterator = resolver.resolve(query);
          
          boost::asio::ssl::stream&lt;boost::asio::ip::tcp::socket&gt; socket(ioService, sslContext);
          
          ioService.run();
          
          // Enable SSL peer verification.
          socket.set_verify_mode(asio::ssl::verify_none);
          SSL_set_tlsext_host_name(socket.native_handle(), &quot;201.175.33.14&quot;);
          
          asio::connect(socket.lowest_layer(), endpointIterator);
          //------------------------------
          //here is where the program fails 
          socket.handshake(asio::ssl::stream_base::client);
          //---------------------------
          boost::asio::streambuf request;
          std::ostream requestStream(&amp;request);
          requestStream &lt;&lt; &quot;GET / HTTP/1.0\r\n&quot;;
          requestStream &lt;&lt; &quot;Host: 201.175.33.14\r\n&quot;;
          requestStream &lt;&lt; &quot;Accept: */*\r\n&quot;;
          requestStream &lt;&lt; &quot;Connection: close\r\n\r\n&quot;;
          
          asio::write(socket, request);
      }catch (std::exception&amp; e)
      {
          std::cout &lt;&lt; e.what();
      }
  }
  </code></pre>
  <p>The output is:</p>
  <p>handshake: dh key too small</p>
  <p>Any ideas on how to solve the problem????
  Thanks</p>