2015-10-23 12:16:23 +02:00
|
|
|
#pragma once
|
|
|
|
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGCREATOR_H
|
|
|
|
#define MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGCREATOR_H
|
2015-10-19 02:46:47 +02:00
|
|
|
|
2016-02-11 16:39:42 +01:00
|
|
|
#include <cpp-utils/pointer/unique_ref.h>
|
|
|
|
#include <cpp-utils/random/RandomGenerator.h>
|
|
|
|
#include <cpp-utils/io/Console.h>
|
2015-10-19 02:46:47 +02:00
|
|
|
#include "CryConfig.h"
|
2016-01-17 14:57:40 +01:00
|
|
|
#include "CryConfigConsole.h"
|
2015-10-19 02:46:47 +02:00
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
class CryConfigCreator final {
|
|
|
|
public:
|
2016-02-21 01:34:21 +01:00
|
|
|
CryConfigCreator(std::shared_ptr<cpputils::Console> console, cpputils::RandomGenerator &encryptionKeyGenerator, bool noninteractive);
|
2015-10-24 19:35:37 +02:00
|
|
|
CryConfigCreator(CryConfigCreator &&rhs) = default;
|
2015-10-19 02:46:47 +02:00
|
|
|
|
2016-01-17 14:57:40 +01:00
|
|
|
CryConfig create(const boost::optional<std::string> &cipherFromCommandLine);
|
2015-10-19 02:46:47 +02:00
|
|
|
private:
|
2016-01-17 14:57:40 +01:00
|
|
|
std::string _generateCipher(const boost::optional<std::string> &cipherFromCommandLine);
|
2015-10-19 02:46:47 +02:00
|
|
|
std::string _generateEncKey(const std::string &cipher);
|
|
|
|
std::string _generateRootBlobKey();
|
|
|
|
|
2016-01-17 14:57:40 +01:00
|
|
|
std::shared_ptr<cpputils::Console> _console;
|
|
|
|
CryConfigConsole _configConsole;
|
2015-10-22 18:48:04 +02:00
|
|
|
cpputils::RandomGenerator &_encryptionKeyGenerator;
|
2015-10-19 02:46:47 +02:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CryConfigCreator);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|