libcryfs/src/config/CryConfigCreator.h

32 lines
1.1 KiB
C
Raw Normal View History

#pragma once
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGCREATOR_H
#define MESSMER_CRYFS_SRC_CONFIG_CRYCONFIGCREATOR_H
2015-10-19 02:46:47 +02:00
#include <messmer/cpp-utils/pointer/unique_ref.h>
2015-10-22 18:48:04 +02:00
#include <messmer/cpp-utils/random/RandomGenerator.h>
2015-10-19 02:46:47 +02:00
#include <messmer/cpp-utils/io/Console.h>
#include "CryConfig.h"
namespace cryfs {
class CryConfigCreator final {
public:
2015-10-22 18:48:04 +02:00
CryConfigCreator(cpputils::unique_ref<cpputils::Console> console, cpputils::RandomGenerator &encryptionKeyGenerator);
CryConfigCreator(CryConfigCreator &&rhs) = default;
2015-10-19 02:46:47 +02:00
CryConfig create(const boost::optional<std::string> &cipher);
2015-10-19 02:46:47 +02:00
private:
std::string _generateCipher(const boost::optional<std::string> &cipher);
std::string _askCipher();
2015-10-19 02:46:47 +02:00
std::string _generateEncKey(const std::string &cipher);
std::string _generateRootBlobKey();
bool _showWarningForCipherAndReturnIfOk(const std::string &cipherName);
cpputils::unique_ref<cpputils::Console> _console;
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