Skip to content

Add documentation for SSL support #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2014

Conversation

jellevdd
Copy link

Initial documentation for adding SSL support to async server.

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "this" in the bind call?

@jellevdd
Copy link
Author

I based the example on the boost example (http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/example/cpp03/ssl/server.cpp), which put the method in a class (which is why the this was there). I could change it to something like this:

std::string password_callback(std::size_t max_length, boost::asio::ssl::context_base::password_purpose purpose) {
    return std::string("test");
}

...
context_.set_password_callback(password_callback);

To get the same functionality. I think that might be better?

@deanberris
Copy link
Member

I think it's best to have an example of the SSL server that you can build/test locally that's also part of the project. If you put something in lib/network/example along in this pull request, then reflect what the code actually looks like here.

@jellevdd
Copy link
Author

I'll create an example based on my local server setup. I'll add it to the pull request, change the documentation and get back to you.
Thanks for the help!

@deanberris
Copy link
Member

Awesome, thanks @jellevdd for doing this!

Created a simple example
Uptate to the documentation based on created simple ssl server
Small bugfix to allow clean shutdown of server without warnings when
using basic ssl (no client authentication)
@jellevdd
Copy link
Author

@deanberris I've added a basic example based one of the existing async server examples. I've added a self-signed private key/certificate (valid for 10 years) to the example to simplify testing.
The documentation has been updated to mirror the example.
While testing basic ssl I've also noticed a small bug which was causing a warning to be thrown during shutdown of the socket when using basic ssl (I tested using mutual authentication which did not cause any issues). I've added the fix to the shutdown as well.

@deanberris
Copy link
Member

@jellevdd Thanks! This looks awesome. :)

Thank you very much for doing this. I'm merging this in, and if you can make an announcement to the mailing list, that would be greatly appreciated too. Having testers give this a go would be great for the project and hopefully we can get a new release rolled out soon after.

deanberris added a commit that referenced this pull request May 22, 2014
Add documentation for SSL support, fix shutdown issues with exceptions.
@deanberris deanberris merged commit c15e98f into cpp-netlib:0.11-devel May 22, 2014
@jellevdd jellevdd deleted the 0.11-devel-integration branch May 22, 2014 07:44
leecoder pushed a commit to leecoder/cpp-netlib that referenced this pull request Apr 14, 2015
Add documentation for SSL support, fix shutdown issues with exceptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants