Boost logo

Boost Users :

Subject: [Boost-users] Using boost asio with client certificate "sslv3 handshake failure"
From: Jeff Perkins (jperks1985_at_[hidden])
Date: 2014-01-12 00:32:56


We are trying to connect to our server using boost asio and getting the
error "handshake: sslv3 alert handshake failure". We have tried changing
the ssl type, setting verify peer to none and a few other things with no
success. The pem file we are using originated as a p12 file that we used
openssl to output to a pem file for use in this project. Within the pem
file there is both an encrypted private key and certificate. I have
searched stackoverflow of a solution but the only similar thing that came
up was openssl not being installed correctly which doesn't appear to be the
problem in this case. Is there something I'm missing in my call back as I'm
not passing a purpose or length, although I cannot find appropriate values
to pass as purpose in the boost docs.

   -

   std::size_t max_length, // The maximum size for a password.
   -

   password_purpose purpose // Whether password is for reading or writing.

   using boost::asio::ip::tcp;

   boost::system::error_code ec; boost::asio::io_service io_service;
   boost::asio::ssl::context ctx(io_service,
   boost::asio::ssl::context::sslv23);

   ctx.set_password_callback(my_password_callback);
   ctx.use_private_key_file("/key1.pem",boost::asio::ssl::context_base::pem,
   ec);

   namespace ssl = boost::asio::ssl; typedef ssl::stream ssl_socket;

   ssl_socket sockconn(io_service, ctx);

   tcp::resolver resolver(io_service); tcp::resolver::query query("
   tech.loopfish.com", "https");

   boost::asio::connect(sockconn.lowest_layer(), resolver.resolve(query));

   sockconn.lowest_layer().set_option(tcp::no_delay(true));

   sockconn.set_verify_mode(boost::asio::ssl::verify_peer);
   sockconn.set_verify_callback(ssl::rfc2818_verification("tech.loopfish.com
   "));

   sockconn.handshake(ssl_socket::client);



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net