libcryfs/src/config/CryConfigLoader.h

37 lines
1.3 KiB
C
Raw Normal View History

#pragma once
2015-10-15 13:06:51 +02:00
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGLOADER_H_
#define MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGLOADER_H_
2015-06-21 17:44:45 +02:00
#include <messmer/cpp-utils/pointer/unique_ref.h>
#include <boost/filesystem.hpp>
2015-10-19 02:46:47 +02:00
#include "CryConfigFile.h"
2015-09-01 00:25:14 +02:00
#include "CryCipher.h"
2015-10-19 02:46:47 +02:00
#include "CryConfigCreator.h"
2015-10-27 22:19:40 +01:00
#include <messmer/cpp-utils/crypto/kdf/Scrypt.h>
namespace cryfs {
class CryConfigLoader final {
public:
CryConfigLoader(cpputils::unique_ref<cpputils::Console> console, cpputils::RandomGenerator &keyGenerator, const cpputils::SCryptSettings &scryptSettings, std::function<std::string()> askPasswordForExistingFilesystem, std::function<std::string()> askPasswordForNewFilesystem, const boost::optional<std::string> &cipher);
CryConfigLoader(CryConfigLoader &&rhs) = default;
boost::optional<CryConfigFile> loadOrCreate(const boost::filesystem::path &filename);
private:
boost::optional<CryConfigFile> _loadConfig(const boost::filesystem::path &filename);
CryConfigFile _createConfig(const boost::filesystem::path &filename);
CryConfigCreator _creator;
cpputils::SCryptSettings _scryptSettings;
std::function<std::string()> _askPasswordForExistingFilesystem;
std::function<std::string()> _askPasswordForNewFilesystem;
boost::optional<std::string> _cipher;
DISALLOW_COPY_AND_ASSIGN(CryConfigLoader);
};
}
#endif