9#include <userver/crypto/certificate.hpp>
10#include <userver/crypto/private_key.hpp>
11#include <userver/engine/deadline.hpp>
12#include <userver/engine/io/common.hpp>
13#include <userver/engine/io/socket.hpp>
14#include <userver/utils/fast_pimpl.hpp>
16USERVER_NAMESPACE_BEGIN
27class [[nodiscard]] TlsWrapper
final :
public RwBase {
30 static TlsWrapper
StartTlsClient(Socket&& socket,
const std::string& server_name, Deadline deadline);
35 const std::string& server_name,
39 const std::vector<crypto::Certificate>& extra_cert_authorities = {}
48 const std::vector<crypto::Certificate>& extra_cert_authorities = {}
51 ~TlsWrapper()
override;
53 TlsWrapper(
const TlsWrapper&) =
delete;
54 TlsWrapper(TlsWrapper&&)
noexcept;
84 [[nodiscard]] Socket
StopTls(Deadline deadline);
90 return RecvSome(buf, len, deadline);
96 return RecvAll(buf, len, deadline);
102 return SendAll(buf, len, deadline);
105 [[nodiscard]] size_t WriteAll(std::initializer_list<IoData> list, Deadline deadline)
override;
110 explicit TlsWrapper(Socket&&);
112 void SetupContextAccessors();
115 class ReadContextAccessor;
116 constexpr static size_t kSize = 336;
117 constexpr static size_t kAlignment = 8;
118 utils::FastPimpl<Impl, kSize, kAlignment> impl_;