Wie man boost::beast-Handshake behebt: no protocols available (SSL routines)

English Deutsch

Problem:

Während der Ausführung Ihrer boost::beast-Anwendung sehen Sie die folgende Ausnahme:

handshake_error_output.txt
terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>'
  what():  handshake: no protocols available (SSL routines) [asio.ssl:167772351]

Lösung

Sie verbinden sich mit einer SSL- oder TLS-Version, die der Server nicht unterstützt.

Die TLS/SSL-Version wird bei der Initialisierung des boost::asio::ssl::context ausgewählt:

ssl_context_example.cpp
namespace ssl = boost::asio::ssl;

ssl::context ctx(ssl::context::tlsv11_client);

In diesem Fall verwenden wir das veraltete TLSv1.1-Protokoll.

Ändern Sie die Zeile in

ssl_context_tlsv13.cpp
ssl::context ctx(ssl::context::tlsv13_client);

um stattdessen TLSv1.3 zu verwenden. Beachten Sie, dass einige ältere TLS/SSL-Versionen als unsicher gelten.


Check out similar posts by category: Boost, C/C++