garciay committed Feb 02, 2018 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 ``````#pragma once #include #include #include #include #include "security_db_record.hh" /*! * \class certificates_loader * \brief This class provides mechanism to load the certificates from the filesystem according the struecture defined in ETSI TS 103 099 * \remark Singleton pattern */ class certificates_loader { std::string _certificateExt; std::string _privateKeyExt; std::string _publicKeysExt; /*! * \brief The full folder path to load certificates */ std::experimental::filesystem::path _full_path; /*! * \brief Set to true when certificates are successfully loaded from file system */ bool _is_cache_initialized; /*! * \brief Directory filter (for local development purposes only */ std::set _directory_filter; /*! * \brief Unique static object reference of this class */ static certificates_loader* instance; /*! * \brief Default private ctor */ certificates_loader(); /*! * \brief Default private dtor */ ~certificates_loader() { if (instance != NULL) { delete instance; instance = NULL; } }; public: /*! \publicsection */ /*! * \brief Public accessor to the single object reference */ 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 >& p_certificates, std::map, const std::string&>& p_hashed_id8s); private: int retrieve_certificates_list(std::set& p_files); int build_certificates_cache(std::set& p_files, std::map >& p_certificates, std::map, const std::string&>& p_hashed_id8s); }; // End of class certificates_loader``````