diff --git a/lib/base/tlsutility.cpp b/lib/base/tlsutility.cpp index 26ae62313..e91f6cd18 100644 --- a/lib/base/tlsutility.cpp +++ b/lib/base/tlsutility.cpp @@ -195,27 +195,6 @@ static void InitSslContext(const Shared::Ptr& context, const String& } } -/** - * Initializes an SSL context using the specified certificates. - * - * @param pubkey The public key. - * @param privkey The matching private key. - * @param cakey CA certificate chain file. - * @returns An SSL context. - */ -Shared::Ptr MakeAsioSslContext(const String& pubkey, const String& privkey, const String& cakey) -{ - namespace ssl = boost::asio::ssl; - - InitializeOpenSSL(); - - auto context (Shared::Make(TlsContext::tls)); - - InitSslContext(context, pubkey, privkey, cakey); - - return context; -} - /** * Set the cipher list to the specified SSL context. * @param context The ssl context. @@ -286,8 +265,12 @@ Shared::Ptr SetupSslContext(const String& certPath, const String& ke Shared::Ptr context; + InitializeOpenSSL(); + try { - context = MakeAsioSslContext(certPath, keyPath, caPath); + context = Shared::Make(TlsContext::tls); + + InitSslContext(context, certPath, keyPath, caPath); } catch (const std::exception&) { BOOST_THROW_EXCEPTION(ScriptError("Cannot make SSL context for cert path: '" + certPath + "' key path: '" + keyPath + "' ca path: '" + caPath + "'.", std::move(di))); diff --git a/lib/base/tlsutility.hpp b/lib/base/tlsutility.hpp index 4a89e5e59..75f3815ca 100644 --- a/lib/base/tlsutility.hpp +++ b/lib/base/tlsutility.hpp @@ -44,7 +44,6 @@ void InitializeOpenSSL(); String GetOpenSSLVersion(); -Shared::Ptr MakeAsioSslContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String()); void AddCRLToSSLContext(const Shared::Ptr& context, const String& crlPath); void AddCRLToSSLContext(X509_STORE *x509_store, const String& crlPath); void SetCipherListToSSLContext(const Shared::Ptr& context, const String& cipherList);