88 using MsgT = std::optional<std::string>;
93 void reset(SSLLib::SSLAPI::Config::Ptr cfg);
105 mSslApi->get().start_handshake();
119 throw std::runtime_error(
"AccHandshaker::process_msg: not configured");
130 uint8_t cleartext[8];
131 api.read_cleartext(cleartext,
sizeof(cleartext));
134 if (api.read_ciphertext_ready())
136 auto reply = api.read_ciphertext();
137 ret = {
reinterpret_cast<const char *
>(reply->c_data()),
138 reinterpret_cast<const char *
>(reply->c_data_end())};
151 throw std::runtime_error(
"AccHandshaker::details: not configured");
153 return mSslApi->get().ssl_handshake_details();
166 mSslApi->get().start_handshake();
static Ptr Create(ArgsT &&...args)
Creates a new instance of RcEnable with the given arguments.
constexpr BufferFlags NO_FLAGS(0u)
no flags set
defines a class that handles SSL/TLS handshaking
std::string details()
returns ssl_handshake_details() if the SSLAPI is available
std::unique_ptr< SslApiBuilder > mSslApi
std::optional< std::string > MsgT
MsgT process_msg(const MsgT &msg)
Incrementally process the CLIENT HELLO / SERVER HELLO exchange.
void reset(SSLLib::SSLAPI::Config::Ptr cfg)
Re-init the handshaker.
The SslApiBuilder struct is used to initialize and configure an SSL/TLS API in OpenVPN.
SslApiBuilder(const SslApiBuilder &)=delete
SSLLib::SSLAPI::Config::Ptr mConfig
Configuration for this SSL server.
openvpn::SSLAPI & get()
get a reference to the encapsulated ssl object
SslApiBuilder(SslApiBuilder &&) noexcept=delete
SslApiBuilder(SSLLib::SSLAPI::Config::Ptr cfg)
Construct a new SslApiBuilder object.
openvpn::SSLAPI::Ptr mServer
Server created from the factory - depends on mConfig and mFactory.
openvpn::SSLFactoryAPI::Ptr mFactory
Factory from the SSL configuration.