Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
workaround for boost 1.53 TLS 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
iamthebot committed Mar 13, 2017
1 parent 6192c13 commit c9febf3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion client_https.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace SimpleWeb {
Client(const std::string& server_port_path, bool verify_certificate=true,
const std::string& cert_file=std::string(), const std::string& private_key_file=std::string(),
const std::string& verify_file=std::string()) :
ClientBase<HTTPS>::ClientBase(server_port_path, 443), context(boost::asio::ssl::context::tlsv12) {
ClientBase<HTTPS>::ClientBase(server_port_path, 443), context(boost::asio::ssl::context::sslv23) {
long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
context.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);
if(cert_file.size()>0 && private_key_file.size()>0) {
context.use_certificate_chain_file(cert_file);
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);
Expand Down
4 changes: 3 additions & 1 deletion server_https.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ namespace SimpleWeb {
}

Server(const std::string& cert_file, const std::string& private_key_file, const std::string& verify_file=std::string()):
ServerBase<HTTPS>::ServerBase(443), context(boost::asio::ssl::context::tlsv12) {
ServerBase<HTTPS>::ServerBase(443), context(boost::asio::ssl::context::sslv23) {
long disallow_ssl_flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1;
context.use_certificate_chain_file(cert_file);
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);
context.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 | disallow_ssl_flags);

if(verify_file.size()>0) {
context.load_verify_file(verify_file);
Expand Down

0 comments on commit c9febf3

Please sign in to comment.