Skip to content

Commit

Permalink
不正な client_cert と client_key でも継続して動作するように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Oct 4, 2024
1 parent 0c4fd48 commit 1d7ea57
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/websocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,26 @@ static std::shared_ptr<boost::asio::ssl::context> CreateSSLContext(
boost::asio::ssl::context::no_sslv3 |
boost::asio::ssl::context::single_dh_use);
if (client_cert) {
boost::system::error_code ec;
ctx->use_certificate(boost::asio::buffer(*client_cert),
boost::asio::ssl::context_base::file_format::pem);
RTC_LOG(LS_INFO) << "client_cert=" << *client_cert;
boost::asio::ssl::context_base::file_format::pem, ec);
if (ec) {
RTC_LOG(LS_WARNING) << "client_cert is set, but use_certificate failed: "
<< ec.message();
} else {
RTC_LOG(LS_INFO) << "client_cert is set";
}
}
if (client_key) {
boost::system::error_code ec;
ctx->use_private_key(boost::asio::buffer(*client_key),
boost::asio::ssl::context_base::file_format::pem);
RTC_LOG(LS_INFO) << "client_key=" << *client_key;
boost::asio::ssl::context_base::file_format::pem, ec);
if (ec) {
RTC_LOG(LS_WARNING) << "client_key is set, but use_certificate failed: "
<< ec.message();
} else {
RTC_LOG(LS_INFO) << "client_key is set";
}
}
return ctx;
}
Expand Down

0 comments on commit 1d7ea57

Please sign in to comment.