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 {
31 const std::string& server_name,
37 const crypto::
PrivateKey& key, Deadline deadline,
38 const std::vector<crypto::Certificate>& cert_authorities = {});
40 ~TlsWrapper()
override;
42 TlsWrapper(
const TlsWrapper&) =
delete;
43 TlsWrapper(TlsWrapper&&)
noexcept;
73 [[nodiscard]] Socket
StopTls(Deadline deadline);
80 return RecvSome(buf, len, deadline);
87 return RecvAll(buf, len, deadline);
94 return SendAll(buf, len, deadline);
97 [[nodiscard]] size_t WriteAll(std::initializer_list<IoData> list,
98 Deadline deadline)
override;
103 explicit TlsWrapper(Socket&&);
105 void SetupContextAccessors();
108 class ReadContextAccessor;
109 constexpr static size_t kSize = 336;
110 constexpr static size_t kAlignment = 8;
111 utils::FastPimpl<Impl, kSize, kAlignment> impl_;