Skip to content

Commit dc45be8

Browse files
ihmc3jn09hkan-tao
andauthored
SSL_CTX_use_certificate_file() -> SSL_CTX_use_certificate_chain_file() (#65)
* According to https://www.openssl.org/docs/man1.0.2/man3/SSL_CTX_use_certificate_file.html, it is preferred to use SSL_CTX_use_certificate_chain_file() instead. * Format Co-authored-by: An Tao <antao2002@gmail.com>
1 parent faea59c commit dc45be8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

trantor/net/ssl/SSLConnection.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@ void initServerSSLContext(const std::shared_ptr<SSLContext> &ctx,
9393
const std::string &certPath,
9494
const std::string &keyPath)
9595
{
96-
auto r = SSL_CTX_use_certificate_file(ctx->get(),
96+
/*auto r = SSL_CTX_use_certificate_file(ctx->get(),
9797
certPath.c_str(),
98-
SSL_FILETYPE_PEM);
98+
SSL_FILETYPE_PEM);*/
99+
100+
auto r = SSL_CTX_use_certificate_chain_file(ctx->get(), certPath.c_str());
99101
if (!r)
100102
{
101103
LOG_FATAL << strerror(errno);
@@ -277,7 +279,7 @@ ssize_t SSLConnection::writeInLoop(const char *buffer, size_t length)
277279
int sslerr = SSL_get_error(sslPtr_->get(), sendLen);
278280
if (sslerr != SSL_ERROR_WANT_WRITE && sslerr != SSL_ERROR_WANT_READ)
279281
{
280-
//LOG_ERROR << "ssl write error:" << sslerr;
282+
// LOG_ERROR << "ssl write error:" << sslerr;
281283
forceClose();
282284
return -1;
283285
}

0 commit comments

Comments
 (0)