ETSI STF525 / Internal Testing test suite This project provides an internal testing test suite and its associated Test Adapter/Codec

certificates_loader.hh
Go to the documentation of this file.
1 #pragma once
2
3 #include <set>
4 #include <map>
5 #include <string>
6
7 #include <experimental/filesystem>
8
9 #include "security_db_record.hh"
10
16 class certificates_loader {
17
18 std::string _certificateExt;
19
20 std::string _privateKeyExt;
21
22 std::string _publicKeysExt;
23
24 std::string _privateEncKeyExt;
25
26 std::string _publicEncKeysExt;
27
28 std::string _hashedidDigestExt;
29
30 std::string _issuerDigestExt;
31
35 std::experimental::filesystem::path _full_path;
36
40 bool _is_cache_initialized;
41
45 std::set<std::string> _directory_filter;
46
50 static certificates_loader* instance;
51
55 certificates_loader();
59 ~certificates_loader() {
60 if (instance != NULL) {
61 delete instance;
62 instance = NULL;
63 }
64 };
65
66 public:
71 inline static certificates_loader& get_instance() {
72 if (instance == NULL) instance = new certificates_loader();
73 return *instance;
74 };
75
76 int build_path(const std::string& p_root_directory);
77
78 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);
79 //int load_certificate(std::unique_ptr<security_db_record> >& p_certificate, std::map<const std::vector<unsigned char>, const std::string&>& p_hashed_id8s);
80 int save_certificate(const security_db_record& p_certificate);
81
82 private:
83 int retrieve_certificates_list(std::set<std::experimental::filesystem::path>& p_files);
84
85 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);
86
87 }; // 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