Rename BasicCredentialManager

This commit is contained in:
Florent Le Coz
2016-02-10 20:10:40 +01:00
parent 0a352e557d
commit a13285d0ff
3 changed files with 15 additions and 15 deletions
+12 -12
View File
@@ -21,10 +21,10 @@ static const std::vector<std::string> default_cert_files = {
"/etc/ca-certificates/extracted/tls-ca-bundle.pem" "/etc/ca-certificates/extracted/tls-ca-bundle.pem"
}; };
Botan::Certificate_Store_In_Memory Basic_Credentials_Manager::certificate_store; Botan::Certificate_Store_In_Memory BasicCredentialsManager::certificate_store;
bool Basic_Credentials_Manager::certs_loaded = false; bool BasicCredentialsManager::certs_loaded = false;
Basic_Credentials_Manager::Basic_Credentials_Manager(const TCPSocketHandler* const socket_handler): BasicCredentialsManager::BasicCredentialsManager(const TCPSocketHandler* const socket_handler):
Botan::Credentials_Manager(), Botan::Credentials_Manager(),
socket_handler(socket_handler), socket_handler(socket_handler),
trusted_fingerprint{} trusted_fingerprint{}
@@ -32,14 +32,14 @@ Basic_Credentials_Manager::Basic_Credentials_Manager(const TCPSocketHandler* con
this->load_certs(); this->load_certs();
} }
void Basic_Credentials_Manager::set_trusted_fingerprint(const std::string& fingerprint) void BasicCredentialsManager::set_trusted_fingerprint(const std::string& fingerprint)
{ {
this->trusted_fingerprint = fingerprint; this->trusted_fingerprint = fingerprint;
} }
void Basic_Credentials_Manager::verify_certificate_chain(const std::string& type, void BasicCredentialsManager::verify_certificate_chain(const std::string& type,
const std::string& purported_hostname, const std::string& purported_hostname,
const std::vector<Botan::X509_Certificate>& certs) const std::vector<Botan::X509_Certificate>& certs)
{ {
log_debug("Checking remote certificate (" << type << ") for hostname " << purported_hostname); log_debug("Checking remote certificate (" << type << ") for hostname " << purported_hostname);
try try
@@ -62,10 +62,10 @@ void Basic_Credentials_Manager::verify_certificate_chain(const std::string& type
} }
} }
void Basic_Credentials_Manager::load_certs() void BasicCredentialsManager::load_certs()
{ {
// Only load the certificates the first time // Only load the certificates the first time
if (Basic_Credentials_Manager::certs_loaded) if (BasicCredentialsManager::certs_loaded)
return; return;
const std::string conf_path = Config::get("ca_file", ""); const std::string conf_path = Config::get("ca_file", "");
std::vector<std::string> paths; std::vector<std::string> paths;
@@ -82,7 +82,7 @@ void Basic_Credentials_Manager::load_certs()
while (!bundle.end_of_data() && bundle.check_available(27)) while (!bundle.end_of_data() && bundle.check_available(27))
{ {
const Botan::X509_Certificate cert(bundle); const Botan::X509_Certificate cert(bundle);
Basic_Credentials_Manager::certificate_store.add_certificate(cert); BasicCredentialsManager::certificate_store.add_certificate(cert);
} }
// Only use the first file that can successfully be read. // Only use the first file that can successfully be read.
goto success; goto success;
@@ -95,10 +95,10 @@ void Basic_Credentials_Manager::load_certs()
// If we could not open one of the files, print a warning // If we could not open one of the files, print a warning
log_warning("The CA could not be loaded, TLS negociation will probably fail."); log_warning("The CA could not be loaded, TLS negociation will probably fail.");
success: success:
Basic_Credentials_Manager::certs_loaded = true; BasicCredentialsManager::certs_loaded = true;
} }
std::vector<Botan::Certificate_Store*> Basic_Credentials_Manager::trusted_certificate_authorities(const std::string&, const std::string&) std::vector<Botan::Certificate_Store*> BasicCredentialsManager::trusted_certificate_authorities(const std::string&, const std::string&)
{ {
return {&this->certificate_store}; return {&this->certificate_store};
} }
+2 -2
View File
@@ -10,10 +10,10 @@
class TCPSocketHandler; class TCPSocketHandler;
class Basic_Credentials_Manager: public Botan::Credentials_Manager class BasicCredentialsManager: public Botan::Credentials_Manager
{ {
public: public:
Basic_Credentials_Manager(const TCPSocketHandler* const socket_handler); BasicCredentialsManager(const TCPSocketHandler* const socket_handler);
void verify_certificate_chain(const std::string& type, void verify_certificate_chain(const std::string& type,
const std::string& purported_hostname, const std::string& purported_hostname,
const std::vector<Botan::X509_Certificate>&) override final; const std::vector<Botan::X509_Certificate>&) override final;
+1 -1
View File
@@ -249,7 +249,7 @@ private:
static Botan::TLS::Policy policy; static Botan::TLS::Policy policy;
static Botan::TLS::Session_Manager_In_Memory session_manager; static Botan::TLS::Session_Manager_In_Memory session_manager;
protected: protected:
Basic_Credentials_Manager credential_manager; BasicCredentialsManager credential_manager;
private: private:
/** /**
* We use a unique_ptr because we may not want to create the object at * We use a unique_ptr because we may not want to create the object at