Browse Source

Use certificate chain in TLS transport with OpenSSL

Paul-Louis Ageneau 1 year ago
parent
commit
f9ee7aff14
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/impl/tlstransport.cpp

+ 3 - 0
src/impl/tlstransport.cpp

@@ -603,6 +603,9 @@ TlsTransport::TlsTransport(variant<shared_ptr<TcpTransport>, shared_ptr<HttpProx
 			auto [x509, pkey] = certificate->credentials();
 			SSL_CTX_use_certificate(mCtx, x509);
 			SSL_CTX_use_PrivateKey(mCtx, pkey);
+
+			for (auto c : certificate->chain())
+				SSL_CTX_add1_chain_cert(mCtx, c); // add1 increments reference count
 		}
 
 		SSL_CTX_set_options(mCtx, SSL_OP_NO_SSLv3 | SSL_OP_NO_RENEGOTIATION);