diff options
author | Hannes Rantzsch <[email protected]> | 2019-06-03 16:40:40 +0200 |
---|---|---|
committer | Hannes Rantzsch <[email protected]> | 2019-06-03 16:45:10 +0200 |
commit | 7a4e4b554e406b0ae6730ac2ccb01dddfc642584 (patch) | |
tree | 3ccc9f265b3bbf4d3f65e4029e9e19c8a1bc2766 /doc | |
parent | 6fdf34f50faa9b22fb969619ce1cdcf6942a692c (diff) |
update docs on TLS::Context
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api_ref/tls.rst | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/doc/api_ref/tls.rst b/doc/api_ref/tls.rst index 5a6c953b1..90fe2f555 100644 --- a/doc/api_ref/tls.rst +++ b/doc/api_ref/tls.rst @@ -1618,6 +1618,7 @@ It offers the following interface: Construct a new TLS stream. The *context* parameter will be used to set up the underlying *native handle*, i.e. the :ref:`TLS::Client <tls_client>`, when :cpp:func:`handshake` is called. + Using code must ensure the context is kept alive for the lifetime of the stream. The further *args* will be forwarded to the *next layer*'s constructor. .. cpp:function:: template <typename... Args> \ @@ -1694,22 +1695,23 @@ It offers the following interface: The return type is an automatically deduced specialization of :cpp:class:`boost::asio::async_result`, depending on the *WriteHandler* type. *WriteHandler* should suffice the `requirements to a Boost.Asio write handler <https://www.boost.org/doc/libs/1_66_0/doc/html/boost_asio/reference/WriteHandler.html>`_. -.. cpp:struct:: TLS::Context +.. cpp:class:: TLS::Context - A helper struct to collect the initialization parameters for the Stream's underlying *native handle* (see :cpp:class:`TLS::Client`). - `TLS::Context` is defined as + A helper class to initialize and configure the Stream's underlying *native handle* (see :cpp:class:`TLS::Client`). - .. code-block:: cpp + .. cpp:function:: Context(Credentials_Manager* credentialsManager, \ + RandomNumberGenerator* randomNumberGenerator, \ + Session_Manager* sessionManager, \ + Policy* policy, \ + Server_Information serverInfo = Server_Information()) - struct Context - { - Credentials_Manager* credentialsManager; - RandomNumberGenerator* randomNumberGenerator; - Session_Manager* sessionManager; - Policy* policy; - Server_Information serverInfo; - }; + Constructor for TLS::Context. + .. cpp:function:: void set_verify_callback(Verify_Callback_T callback) + + Set a user-defined callback function for certificate chain verification. This + will cause the stream to override the default implementation of the + :cpp:func:`tls_verify_cert_chain` callback. Stream Code Example ^^^^^^^^^^^^^^^^^^^^ @@ -1753,11 +1755,11 @@ Stream Code Example boost::asio::ip::tcp::resolver::iterator endpoint_iterator, http::request<http::string_body> req) : request_(req) - , ctx_{&credentials_mgr_, + , ctx_(&credentials_mgr_, &rng_, &session_mgr_, &policy_, - Botan::TLS::Server_Information()} + Botan::TLS::Server_Information()) , stream_(io_context, ctx_) { boost::asio::async_connect(stream_.lowest_layer(), endpoint_iterator, |