Use secure TLS/SSL versions:

TLS1.2 can be used instead, it is available in all currently
supported versions of OpenSSL.

Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
Damian Jarek
2019-03-14 17:40:41 +01:00
committed by Vinnie Falco
parent 0033b7c1e4
commit 8869ec5681
23 changed files with 62 additions and 61 deletions

View File

@@ -1,6 +1,7 @@
Version 233: Version 233:
* Check __ANDROID__ instead * Check __ANDROID__ instead
* Use secure TLS/SSL versions
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@@ -971,7 +971,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -220,7 +220,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23_client}; ssl::context ctx{ssl::context::tlsv12_client};
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -153,7 +153,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23_client}; ssl::context ctx{ssl::context::tlsv12_client};
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -57,7 +57,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx(ssl::context::sslv23_client); ssl::context ctx(ssl::context::tlsv12_client);
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -521,7 +521,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -402,7 +402,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -671,7 +671,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -523,7 +523,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -325,7 +325,7 @@ int main(int argc, char* argv[])
net::io_context ioc{1}; net::io_context ioc{1};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -231,7 +231,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23_client}; ssl::context ctx{ssl::context::tlsv12_client};
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -147,7 +147,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23_client}; ssl::context ctx{ssl::context::tlsv12_client};
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -55,7 +55,7 @@ int main(int argc, char** argv)
net::io_context ioc; net::io_context ioc;
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23_client}; ssl::context ctx{ssl::context::tlsv12_client};
// This holds the root certificate used for verification // This holds the root certificate used for verification
load_root_certificates(ctx); load_root_certificates(ctx);

View File

@@ -279,7 +279,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -177,7 +177,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -282,7 +282,7 @@ int main(int argc, char* argv[])
net::io_context ioc{threads}; net::io_context ioc{threads};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -107,7 +107,7 @@ int main(int argc, char* argv[])
net::io_context ioc{1}; net::io_context ioc{1};
// The SSL context is required, and holds certificates // The SSL context is required, and holds certificates
ssl::context ctx{ssl::context::sslv23}; ssl::context ctx{ssl::context::tlsv12};
// This holds the self-signed certificate used by the server // This holds the self-signed certificate used by the server
load_server_certificate(ctx); load_server_certificate(ctx);

View File

@@ -45,7 +45,7 @@ namespace beast {
To use this template with a @ref tcp_stream, you would write: To use this template with a @ref tcp_stream, you would write:
@code @code
net::io_context ioc; net::io_context ioc;
net::ssl::context ctx{net::ssl::context::sslv23}; net::ssl::context ctx{net::ssl::context::tlsv12};
beast::ssl_stream<beast::tcp_stream> sock{ioc, ctx}; beast::ssl_stream<beast::tcp_stream> sock{ioc, ctx};
@endcode @endcode

View File

@@ -255,7 +255,7 @@ net::ip::tcp::socket sock{ios};
{ {
//[wss_snippet_2 //[wss_snippet_2
net::ssl::context ctx{net::ssl::context::sslv23}; net::ssl::context ctx{net::ssl::context::tlsv12};
stream<net::ssl::stream<net::ip::tcp::socket>> wss{ios, ctx}; stream<net::ssl::stream<net::ip::tcp::socket>> wss{ios, ctx};
//] //]
} }
@@ -263,7 +263,7 @@ net::ip::tcp::socket sock{ios};
{ {
//[wss_snippet_3 //[wss_snippet_3
net::ip::tcp::endpoint ep; net::ip::tcp::endpoint ep;
net::ssl::context ctx{net::ssl::context::sslv23}; net::ssl::context ctx{net::ssl::context::tlsv12};
stream<net::ssl::stream<net::ip::tcp::socket>> ws{ios, ctx}; stream<net::ssl::stream<net::ip::tcp::socket>> ws{ios, ctx};
// connect the underlying TCP/IP socket // connect the underlying TCP/IP socket

View File

@@ -31,7 +31,7 @@ public:
testTeardown() testTeardown()
{ {
net::io_context ioc; net::io_context ioc;
net::ssl::context ctx(net::ssl::context::sslv23); net::ssl::context ctx(net::ssl::context::tlsv12);
Socket ss(ioc, ctx); Socket ss(ioc, ctx);
struct handler struct handler

View File

@@ -299,7 +299,7 @@ https_get (std::string const& host, std::string const& target, error_code& ec)
// This context is used to hold client and server certificates. // This context is used to hold client and server certificates.
// We do not perform certificate verification in this example. // We do not perform certificate verification in this example.
net::ssl::context ctx(net::ssl::context::sslv23); net::ssl::context ctx(net::ssl::context::tlsv12);
// This string will hold the body of the HTTP response, if any. // This string will hold the body of the HTTP response, if any.
std::string result; std::string result;

View File

@@ -22,5 +22,5 @@ std::thread t{[&](){ ioc.run(); }};
tcp::socket sock(ioc); tcp::socket sock(ioc);
ssl::context ctx(ssl::context::sslv23); ssl::context ctx(ssl::context::tlsv12);

View File

@@ -16,6 +16,6 @@ using namespace boost::beast::websocket;
net::io_context ioc; net::io_context ioc;
tcp_stream sock(ioc); tcp_stream sock(ioc);
net::ssl::context ctx(net::ssl::context::sslv23); net::ssl::context ctx(net::ssl::context::tlsv12);
//] //]