Boost logo

Boost Users :

Subject: [Boost-users] [Asio] ssl socket server example wont work
From: Jan Dinger (dinger.jan_at_[hidden])
Date: 2010-06-14 13:17:41


Hello folks,

I've been to test the boost asio ssl socket example:
http://www.boost.org/doc/libs/1_43_0/doc/html/boost_asio/example/ssl/server.cpp
The code is copy & paste.
The program compiled without problems, if I start the program I became
an exception:

### snip ###
Exception: Invalid argument
### snap ###

While I'm debugging the program I find out the error throws in the
following lines...

### snip ###
context_.set_options(
        boost::asio::ssl::context::default_workarounds
        | boost::asio::ssl::context::no_sslv2
        | boost::asio::ssl::context::single_dh_use);
    context_.set_password_callback(boost::bind(&server::get_password, this));
    context_.use_certificate_chain_file("ca_cert.pem");
    context_.use_private_key_file("ca_cert.pem",
boost::asio::ssl::context::pem);
    context_.use_tmp_dh_file("dh512.pem");
### snap ###

I can't locate the error exactly, could it be I've created my
certificates with wrong steps?

Here is the code, I've created my certificates.

Root Certificate
### snip ###
openssl req -new -x509 -keyout ssl_priv.pem -out ca_cert.pem -days 3650
### snap ###

Diffie-Hellmann
### snip ###
openssl dhparam -out dh1024.pem 512
### snap ###

I've linked the required boost libraries and the OpenSSL Library...

Whats going wrong, can everyone help me?

Thanks.

so long
jd


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