File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -202,13 +202,15 @@ void TcpClient::removeConnection(const TcpConnectionPtr &conn)
202
202
}
203
203
}
204
204
205
- void TcpClient::enableSSL (bool useOldTLS,
206
- bool validateCert,
207
- std::string hostname)
205
+ void TcpClient::enableSSL (
206
+ bool useOldTLS,
207
+ bool validateCert,
208
+ std::string hostname,
209
+ const std::vector<std::pair<std::string, std::string>> &sslConfCmds)
208
210
{
209
211
#ifdef USE_OPENSSL
210
212
/* Create a new OpenSSL context */
211
- sslCtxPtr_ = newSSLContext (useOldTLS, validateCert, {} );
213
+ sslCtxPtr_ = newSSLContext (useOldTLS, validateCert, sslConfCmds );
212
214
validateCert_ = validateCert;
213
215
if (!hostname.empty ())
214
216
{
Original file line number Diff line number Diff line change @@ -193,16 +193,20 @@ class TRANTOR_EXPORT TcpClient : NonCopyable
193
193
* @brief Enable SSL encryption.
194
194
* @param useOldTLS If true, the TLS 1.0 and 1.1 are supported by the
195
195
* client.
196
- * @param hostname The server hostname for SNI. If it is empty, the SNI is
197
- * not used.
198
196
* @param validateCert If true, we try to validate if the peer's SSL cert
199
197
* is valid.
198
+ * @param hostname The server hostname for SNI. If it is empty, the SNI is
199
+ * not used.
200
+ * @param sslConfCmds The commands used to call the SSL_CONF_cmd function in
201
+ * OpenSSL.
200
202
* @note It's well known that TLS 1.0 and 1.1 are not considered secure in
201
203
* 2020. And it's a good practice to only use TLS 1.2 and above.
202
204
*/
203
205
void enableSSL (bool useOldTLS = false ,
204
206
bool validateCert = true ,
205
- std::string hostname = " " );
207
+ std::string hostname = " " ,
208
+ const std::vector<std::pair<std::string, std::string>>
209
+ &sslConfCmds = {});
206
210
207
211
private:
208
212
// / Not thread safe, but in loop
Original file line number Diff line number Diff line change @@ -230,6 +230,8 @@ class TRANTOR_EXPORT TcpConnection
230
230
* established.
231
231
* @param hostname The server hostname for SNI. If it is empty, the SNI is
232
232
* not used.
233
+ * @param sslConfCmds The commands used to call the SSL_CONF_cmd function in
234
+ * OpenSSL.
233
235
*/
234
236
virtual void startClientEncryption (
235
237
std::function<void ()> callback,
Original file line number Diff line number Diff line change @@ -202,6 +202,8 @@ class TRANTOR_EXPORT TcpServer : NonCopyable
202
202
* @param keyPath The path of the private key file.
203
203
* @param useOldTLS If true, the TLS 1.0 and 1.1 are supported by the
204
204
* server.
205
+ * @param sslConfCmds The commands used to call the SSL_CONF_cmd function in
206
+ * OpenSSL.
205
207
* @note It's well known that TLS 1.0 and 1.1 are not considered secure in
206
208
* 2020. And it's a good practice to only use TLS 1.2 and above.
207
209
*/
You can’t perform that action at this time.
0 commit comments