xrpld
Loading...
Searching...
No Matches
xrpl::HTTPClientSSLContext Class Reference

#include <HTTPClientSSLContext.h>

Collaboration diagram for xrpl::HTTPClientSSLContext:

Public Member Functions

 HTTPClientSSLContext (std::string const &sslVerifyDir, std::string const &sslVerifyFile, bool sslVerify, beast::Journal j, boost::asio::ssl::context_base::method method=boost::asio::ssl::context::sslv23)
boost::asio::ssl::context & context ()
bool sslVerify () const
template<class T, class = std::enable_if_t< std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> || std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>>>>
boost::system::error_code preConnectVerify (T &strm, std::string const &host)
 invoked before connect/async_connect on an ssl stream to setup name verification.
template<class T, class = std::enable_if_t< std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> || std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>>>>
boost::system::error_code postConnectVerify (T &strm, std::string const &host)
 invoked after connect/async_connect but before sending data on an ssl stream - to setup name verification.

Static Public Member Functions

static bool rfc6125Verify (std::string const &domain, bool preverified, boost::asio::ssl::verify_context &ctx, beast::Journal j)
 callback invoked for name verification - just passes through to the asio host_name_verification (rfc6125) implementation.

Private Attributes

boost::asio::ssl::context sslContext_
beast::Journal const j_
bool const verify_

Detailed Description

Definition at line 15 of file HTTPClientSSLContext.h.

Constructor & Destructor Documentation

◆ HTTPClientSSLContext()

xrpl::HTTPClientSSLContext::HTTPClientSSLContext ( std::string const & sslVerifyDir,
std::string const & sslVerifyFile,
bool sslVerify,
beast::Journal j,
boost::asio::ssl::context_base::method method = boost::asio::ssl::context::sslv23 )
explicit

Definition at line 18 of file HTTPClientSSLContext.h.

Member Function Documentation

◆ context()

boost::asio::ssl::context & xrpl::HTTPClientSSLContext::context ( )

Definition at line 56 of file HTTPClientSSLContext.h.

◆ sslVerify()

bool xrpl::HTTPClientSSLContext::sslVerify ( ) const
nodiscard

Definition at line 62 of file HTTPClientSSLContext.h.

◆ preConnectVerify()

template<class T, class = std::enable_if_t< std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> || std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>>>>
boost::system::error_code xrpl::HTTPClientSSLContext::preConnectVerify ( T & strm,
std::string const & host )

invoked before connect/async_connect on an ssl stream to setup name verification.

If we intend to verify the SSL connection, we need to set the default domain for server name indication prior to connecting

Parameters
strmasio ssl stream
hosthostname to verify
Returns
error_code indicating failures, if any

Definition at line 85 of file HTTPClientSSLContext.h.

◆ postConnectVerify()

template<class T, class = std::enable_if_t< std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket>> || std::is_same_v<T, boost::asio::ssl::stream<boost::asio::ip::tcp::socket&>>>>
boost::system::error_code xrpl::HTTPClientSSLContext::postConnectVerify ( T & strm,
std::string const & host )

invoked after connect/async_connect but before sending data on an ssl stream - to setup name verification.

Parameters
strmasio ssl stream
hosthostname to verify

Definition at line 112 of file HTTPClientSSLContext.h.

◆ rfc6125Verify()

bool xrpl::HTTPClientSSLContext::rfc6125Verify ( std::string const & domain,
bool preverified,
boost::asio::ssl::verify_context & ctx,
beast::Journal j )
static

callback invoked for name verification - just passes through to the asio host_name_verification (rfc6125) implementation.

Parameters
domainhostname expected
preverifiedpassed by implementation
ctxpassed by implementation
jjournal for logging

Definition at line 141 of file HTTPClientSSLContext.h.

Member Data Documentation

◆ sslContext_

boost::asio::ssl::context xrpl::HTTPClientSSLContext::sslContext_
private

Definition at line 156 of file HTTPClientSSLContext.h.

◆ j_

beast::Journal const xrpl::HTTPClientSSLContext::j_
private

Definition at line 157 of file HTTPClientSSLContext.h.

◆ verify_

bool const xrpl::HTTPClientSSLContext::verify_
private

Definition at line 158 of file HTTPClientSSLContext.h.