#pragma once #ifndef MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGLOADER_H_ #define MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGLOADER_H_ #include #include #include "CryConfig.h" #include "CryCipher.h" #include #include namespace cryfs { class CryConfigLoader { public: CryConfigLoader(); explicit CryConfigLoader(cpputils::unique_ref console); cpputils::unique_ref loadOrCreate(const boost::filesystem::path &filename); cpputils::unique_ref createNew(const boost::filesystem::path &filename); boost::optional> loadExisting(const boost::filesystem::path &filename); //This method is only for testing purposes, because creating weak keys is much faster than creating strong keys. cpputils::unique_ref loadOrCreateWithWeakKey(const boost::filesystem::path &filename); cpputils::unique_ref createNewWithWeakKey(const boost::filesystem::path &filename); private: void _initializeConfig(CryConfig *config); void _generateCipher(CryConfig *config); void _generateEncKey(CryConfig *config); void _generateRootBlobKey(CryConfig *config); void _initializeConfigWithWeakKey(CryConfig *config); // TODO Rename to _initializeConfigForTest void _generateWeakEncKey(CryConfig *config); // TODO Rename to _generateTestEncKey void _generateTestCipher(CryConfig *config); bool _showWarningForCipherAndReturnIfOk(const std::string &cipherName); cpputils::unique_ref _console; }; } #endif