certificates_loader.hh
Go to the documentation of this file.
#pragma once
#include <set>
#include <map>
#include <string>
#include <experimental/filesystem>
#include "security_db_record.hh"
class certificates_loader {
std::string _certificateExt;
std::string _privateKeyExt;
std::string _publicKeysExt;
std::string _privateEncKeyExt;
std::string _publicEncKeysExt;
std::string _hashedidDigestExt;
std::string _issuerDigestExt;
std::experimental::filesystem::path _full_path;
bool _is_cache_initialized;
std::set<std::string> _directory_filter;
static certificates_loader* instance;
certificates_loader();
~certificates_loader() {
if (instance != NULL) {
delete instance;
instance = NULL;
}
};
public:
inline static certificates_loader& get_instance() {
if (instance == NULL) instance = new certificates_loader();
return *instance;
};
int build_path(const std::string& p_root_directory);
int load_certificates(std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, std::map<std::vector<unsigned char>, std::string>& p_hashed_id8s);
//int load_certificate(std::unique_ptr<security_db_record> >& p_certificate, std::map<const std::vector<unsigned char>, const std::string&>& p_hashed_id8s);
int save_certificate(const security_db_record& p_certificate);
private:
int retrieve_certificates_list(std::set<std::experimental::filesystem::path>& p_files);
int build_certificates_cache(std::set<std::experimental::filesystem::path>& p_files, std::map<std::string, std::unique_ptr<security_db_record> >& p_certificates, std::map<std::vector<unsigned char>, std::string>& p_hashed_id8s);
}; // End of class certificates_loader
certificates_loader::_is_cache_initialized
bool _is_cache_initialized
Set to true when certificates are successfully loaded from file system.
Definition: certificates_loader.hh:40
certificates_loader::_issuerDigestExt
std::string _issuerDigestExt
Definition: certificates_loader.hh:30
certificates_loader::build_path
int build_path(const std::string &p_root_directory)
Definition: certificates_loader.cc:20
certificates_loader::retrieve_certificates_list
int retrieve_certificates_list(std::set< std::experimental::filesystem::path > &p_files)
Definition: certificates_loader.cc:71
certificates_loader::_full_path
std::experimental::filesystem::path _full_path
The full folder path to load certificates.
Definition: certificates_loader.hh:35
certificates_loader::load_certificates
int load_certificates(std::map< std::string, std::unique_ptr< security_db_record > > &p_certificates, std::map< std::vector< unsigned char >, std::string > &p_hashed_id8s)
Definition: certificates_loader.cc:46
certificates_loader::_privateEncKeyExt
std::string _privateEncKeyExt
Definition: certificates_loader.hh:24
security_db_record.hh
security_db_record
This class provides security record description for security database.
Definition: security_db_record.hh:16
certificates_loader::get_instance
static certificates_loader & get_instance()
Public accessor to the single object reference.
Definition: certificates_loader.hh:71
certificates_loader::_publicKeysExt
std::string _publicKeysExt
Definition: certificates_loader.hh:22
certificates_loader::build_certificates_cache
int build_certificates_cache(std::set< std::experimental::filesystem::path > &p_files, std::map< std::string, std::unique_ptr< security_db_record > > &p_certificates, std::map< std::vector< unsigned char >, std::string > &p_hashed_id8s)
Definition: certificates_loader.cc:119
certificates_loader::~certificates_loader
~certificates_loader()
Default private dtor.
Definition: certificates_loader.hh:59
certificates_loader::_publicEncKeysExt
std::string _publicEncKeysExt
Definition: certificates_loader.hh:26
certificates_loader::_privateKeyExt
std::string _privateKeyExt
Definition: certificates_loader.hh:20
certificates_loader::save_certificate
int save_certificate(const security_db_record &p_certificate)
Definition: certificates_loader.cc:295
certificates_loader::certificates_loader
certificates_loader()
Default private ctor.
Definition: certificates_loader.cc:16
certificates_loader::_certificateExt
std::string _certificateExt
Definition: certificates_loader.hh:18
certificates_loader::_hashedidDigestExt
std::string _hashedidDigestExt
Definition: certificates_loader.hh:28
certificates_loader::instance
static certificates_loader * instance
Unique static object reference of this class.
Definition: certificates_loader.hh:50
certificates_loader
This class provides mechanism to load the certificates from the filesystem according the struecture d...
Definition: certificates_loader.hh:16
certificates_loader::_directory_filter
std::set< std::string > _directory_filter
Directory filter (for local development purposes only.
Definition: certificates_loader.hh:45