|
@@ -73,33 +73,34 @@ bool TLSContext::bad() const
|
|
|
return !_good;
|
|
|
}
|
|
|
|
|
|
-void TLSContext::addClientKeyFile(const std::string& certfile,
|
|
|
+bool TLSContext::addClientKeyFile(const std::string& certfile,
|
|
|
const std::string& keyfile)
|
|
|
- throw(DlAbortEx)
|
|
|
{
|
|
|
if(SSL_CTX_use_PrivateKey_file(_sslCtx, keyfile.c_str(),
|
|
|
SSL_FILETYPE_PEM) != 1) {
|
|
|
- throw DL_ABORT_EX
|
|
|
- (StringFormat
|
|
|
- ("Failed to load client private key from %s. Cause: %s",
|
|
|
- keyfile.c_str(), ERR_error_string(ERR_get_error(), 0)).str());
|
|
|
+ _logger->error("Failed to load client private key from %s. Cause: %s",
|
|
|
+ keyfile.c_str(), ERR_error_string(ERR_get_error(), 0));
|
|
|
+ return false;
|
|
|
}
|
|
|
if(SSL_CTX_use_certificate_chain_file(_sslCtx, certfile.c_str()) != 1) {
|
|
|
- throw DL_ABORT_EX
|
|
|
- (StringFormat
|
|
|
- ("Failed to load client certificate from %s. Cause: %s",
|
|
|
- certfile.c_str(), ERR_error_string(ERR_get_error(), 0)).str());
|
|
|
+ _logger->error("Failed to load client certificate from %s. Cause: %s",
|
|
|
+ certfile.c_str(), ERR_error_string(ERR_get_error(), 0));
|
|
|
+ return false;
|
|
|
}
|
|
|
+ _logger->info("Client Key File(cert=%s, key=%s) were successfully added.",
|
|
|
+ certfile.c_str(), keyfile.c_str());
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
-void TLSContext::addTrustedCACertFile(const std::string& certfile)
|
|
|
- throw(DlAbortEx)
|
|
|
+bool TLSContext::addTrustedCACertFile(const std::string& certfile)
|
|
|
{
|
|
|
if(SSL_CTX_load_verify_locations(_sslCtx, certfile.c_str(), 0) != 1) {
|
|
|
- throw DL_ABORT_EX
|
|
|
- (StringFormat
|
|
|
- (MSG_LOADING_TRUSTED_CA_CERT_FAILED,
|
|
|
- certfile.c_str(), ERR_error_string(ERR_get_error(), 0)).str());
|
|
|
+ _logger->error(MSG_LOADING_TRUSTED_CA_CERT_FAILED,
|
|
|
+ certfile.c_str(), ERR_error_string(ERR_get_error(), 0));
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ _logger->info("Trusted CA certificates were successfully added.");
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
|