mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 06:15:24 +02:00
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:
committed by
Vinnie Falco
parent
0033b7c1e4
commit
8869ec5681
@@ -1,6 +1,7 @@
|
|||||||
Version 233:
|
Version 233:
|
||||||
|
|
||||||
* Check __ANDROID__ instead
|
* Check __ANDROID__ instead
|
||||||
|
* Use secure TLS/SSL versions
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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);
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
@@ -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
|
||||||
|
@@ -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
|
||||||
|
@@ -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;
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
|
@@ -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);
|
||||||
|
|
||||||
//]
|
//]
|
||||||
|
Reference in New Issue
Block a user