10#include <userver/crypto/certificate.hpp>
11#include <userver/crypto/private_key.hpp>
13USERVER_NAMESPACE_BEGIN
22 static SslCtx CreateServerTlsContext(
23 const crypto::CertificatesChain& cert_chain,
24 const crypto::PrivateKey& key,
25 const std::vector<crypto::Certificate>& extra_cert_authorities = {}
28 static SslCtx CreateClientTlsContext(std::string_view server_name);
30 static SslCtx CreateClientTlsContext(
31 std::string_view server_name,
32 const crypto::Certificate& cert,
33 const crypto::PrivateKey& key,
34 const std::vector<crypto::Certificate>& extra_cert_authorities = {}
41 SslCtx(
const SslCtx&) =
delete;
44 void* GetRawSslCtx()
const noexcept;
47 void AddCertAuthorities(
const std::vector<Certificate>& cert_authorities);
48 void EnableVerifyClientCertificate();
49 void SetServerName(std::string_view server_name);
50 void SetCertificate(
const crypto::Certificate& cert);
51 void SetCertificates(
const crypto::CertificatesChain& cert_chain);
52 void SetPrivateKey(
const crypto::PrivateKey& key);
55 std::unique_ptr<Impl> impl_{};
57 explicit SslCtx(std::unique_ptr<Impl>&& impl);