mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-26 11:08:51 +02:00
Merge MakeAsioSslContext() into SetupSslContext()
This commit is contained in:
parent
fa08e90630
commit
86ba556615
@ -195,27 +195,6 @@ static void InitSslContext(const Shared<TlsContext>::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<TlsContext>::Ptr MakeAsioSslContext(const String& pubkey, const String& privkey, const String& cakey)
|
|
||||||
{
|
|
||||||
namespace ssl = boost::asio::ssl;
|
|
||||||
|
|
||||||
InitializeOpenSSL();
|
|
||||||
|
|
||||||
auto context (Shared<TlsContext>::Make(TlsContext::tls));
|
|
||||||
|
|
||||||
InitSslContext(context, pubkey, privkey, cakey);
|
|
||||||
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the cipher list to the specified SSL context.
|
* Set the cipher list to the specified SSL context.
|
||||||
* @param context The ssl context.
|
* @param context The ssl context.
|
||||||
@ -286,8 +265,12 @@ Shared<TlsContext>::Ptr SetupSslContext(const String& certPath, const String& ke
|
|||||||
|
|
||||||
Shared<TlsContext>::Ptr context;
|
Shared<TlsContext>::Ptr context;
|
||||||
|
|
||||||
|
InitializeOpenSSL();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
context = MakeAsioSslContext(certPath, keyPath, caPath);
|
context = Shared<TlsContext>::Make(TlsContext::tls);
|
||||||
|
|
||||||
|
InitSslContext(context, certPath, keyPath, caPath);
|
||||||
} catch (const std::exception&) {
|
} catch (const std::exception&) {
|
||||||
BOOST_THROW_EXCEPTION(ScriptError("Cannot make SSL context for cert path: '"
|
BOOST_THROW_EXCEPTION(ScriptError("Cannot make SSL context for cert path: '"
|
||||||
+ certPath + "' key path: '" + keyPath + "' ca path: '" + caPath + "'.", std::move(di)));
|
+ certPath + "' key path: '" + keyPath + "' ca path: '" + caPath + "'.", std::move(di)));
|
||||||
|
@ -44,7 +44,6 @@ void InitializeOpenSSL();
|
|||||||
|
|
||||||
String GetOpenSSLVersion();
|
String GetOpenSSLVersion();
|
||||||
|
|
||||||
Shared<TlsContext>::Ptr MakeAsioSslContext(const String& pubkey = String(), const String& privkey = String(), const String& cakey = String());
|
|
||||||
void AddCRLToSSLContext(const Shared<TlsContext>::Ptr& context, const String& crlPath);
|
void AddCRLToSSLContext(const Shared<TlsContext>::Ptr& context, const String& crlPath);
|
||||||
void AddCRLToSSLContext(X509_STORE *x509_store, const String& crlPath);
|
void AddCRLToSSLContext(X509_STORE *x509_store, const String& crlPath);
|
||||||
void SetCipherListToSSLContext(const Shared<TlsContext>::Ptr& context, const String& cipherList);
|
void SetCipherListToSSLContext(const Shared<TlsContext>::Ptr& context, const String& cipherList);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user