25 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
26 result.append(
"ECDHE-ECDSA-AES128-GCM-SHA256");
28 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
29 result.append(
"ECDHE-ECDSA-AES256-GCM-SHA384");
31 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
32 result.append(
"ECDHE-ECDSA-CHACHA20-POLY1305");
34 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
35 result.append(
"ECDHE-ECDSA-AES128-SHA256");
37 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
38 result.append(
"ECDHE-ECDSA-AES256-SHA384");
50 case Tls13CipherSuites::TLS_AES_128_GCM_SHA256:
51 result.append(
"TLS_AES_128_GCM_SHA256");
53 case Tls13CipherSuites::TLS_AES_256_GCM_SHA384:
54 result.append(
"TLS_AES_256_GCM_SHA384");
56 case Tls13CipherSuites::TLS_CHACHA20_POLY1305_SHA256:
57 result.append(
"TLS_CHACHA20_POLY1305_SHA256");
59 case Tls13CipherSuites::TLS_AES_128_CCM_SHA256:
60 result.append(
"TLS_AES_128_CCM_SHA256");
62 case Tls13CipherSuites::TLS_AES_128_CCM_8_SHA256:
63 result.append(
"TLS_AES_128_CCM_8_SHA256");
74 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:
75 result.append(
"ECDHE-ECDSA-AES128-GCM-SHA256");
77 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:
78 result.append(
"ECDHE-ECDSA-AES256-GCM-SHA384");
80 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:
81 result.append(
"ECDHE-ECDSA-CHACHA20-POLY1305");
83 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256:
84 result.append(
"ECDHE-ECDSA-AES128-SHA256");
86 case Tls12CipherSuites::TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384:
87 result.append(
"ECDHE-ECDSA-AES256-SHA384");
99 case Tls13CipherSuites::TLS_AES_128_GCM_SHA256:
100 result.append(
"TLS_AES_128_GCM_SHA256");
102 case Tls13CipherSuites::TLS_AES_256_GCM_SHA384:
103 result.append(
"TLS_AES_256_GCM_SHA384");
105 case Tls13CipherSuites::TLS_CHACHA20_POLY1305_SHA256:
106 result.append(
"TLS_CHACHA20_POLY1305_SHA256");
108 case Tls13CipherSuites::TLS_AES_128_CCM_SHA256:
109 result.append(
"TLS_AES_128_CCM_SHA256");
111 case Tls13CipherSuites::TLS_AES_128_CCM_8_SHA256:
112 result.append(
"TLS_AES_128_CCM_8_SHA256");
118 template<
typename CipherType>
120 return std::accumulate(ciphers.begin(), ciphers.end(), std::string{},
121 [](std::string
const& result, CipherType
const& cipher) -> std::string {
122 std::string calculated_ssl_string{};
123 if (result.empty()) {
124 calculated_ssl_string.append(ToOpenSslString(cipher));
126 calculated_ssl_string.append(result);
127 calculated_ssl_string.append(
":");
128 calculated_ssl_string.append(ToOpenSslString(cipher));
130 return calculated_ssl_string;
136 : ssl_context_{boost::asio::ssl::context::tlsv12_client} {
138 ssl_context_.load_verify_file(std::string{ca_certification_path});
140 if (SSL_CTX_set_cipher_list(ssl_context_.native_handle(),
147 : ssl_context_{boost::asio::ssl::context::tlsv13_client} {
149 ssl_context_.load_verify_file(std::string{ca_certification_path});
151 if (SSL_CTX_set_ciphersuites(ssl_context_.native_handle(),
158 std::string_view private_key_path) noexcept
159 : ssl_context_{boost::asio::ssl::context::tlsv12_server} {
161 ssl_context_.use_certificate_chain_file(std::string{certificate_path});
162 ssl_context_.use_private_key_file(std::string{private_key_path}, boost::asio::ssl::context::pem);
164 if (SSL_CTX_set_ciphersuites(ssl_context_.native_handle(),
171 std::string_view private_key_path) noexcept
172 : ssl_context_{boost::asio::ssl::context::tlsv13_server} {
174 ssl_context_.use_certificate_chain_file(std::string{certificate_path});
175 ssl_context_.use_private_key_file(std::string{private_key_path}, boost::asio::ssl::context::pem);
177 if (SSL_CTX_set_ciphersuites(ssl_context_.native_handle(),
Tls13CipherSuites
The TLS 1.3 cipher suites supported.
Tls12CipherSuites
The TLS 1.2 cipher suites supported.
Tls12CipherSuites
The TLS 1.2 cipher suites supported.
Tls13CipherSuites
The TLS 1.3 cipher suites supported.
auto ToOpenSslString(server::tls::Tls13CipherSuites cipher) noexcept -> std::string
auto ConvertCipherListToString(std::initializer_list< CipherType > ciphers) noexcept -> std::string
Template type for Tls version.