2015-10-15 13:06:51 +02:00
|
|
|
#pragma once
|
|
|
|
#ifndef MESSMER_CRYFS_SRC_CONFIG_CRYCIPHER_H
|
|
|
|
#define MESSMER_CRYFS_SRC_CONFIG_CRYCIPHER_H
|
2015-09-01 00:25:14 +02:00
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <messmer/cpp-utils/pointer/unique_ref.h>
|
|
|
|
#include <messmer/blockstore/interface/BlockStore.h>
|
2015-10-22 18:48:04 +02:00
|
|
|
#include <messmer/cpp-utils/random/RandomGenerator.h>
|
2015-09-01 00:25:14 +02:00
|
|
|
|
|
|
|
namespace cryfs {
|
|
|
|
|
|
|
|
class CryCipher {
|
|
|
|
public:
|
2015-10-17 21:33:41 +02:00
|
|
|
virtual ~CryCipher() {}
|
|
|
|
|
2015-09-04 16:02:55 +02:00
|
|
|
virtual const std::string &cipherName() const = 0;
|
|
|
|
virtual const boost::optional<std::string> &warning() const = 0;
|
2015-09-01 00:25:14 +02:00
|
|
|
virtual cpputils::unique_ref<blockstore::BlockStore> createEncryptedBlockstore(cpputils::unique_ref<blockstore::BlockStore> baseBlockStore, const std::string &encKey) const = 0;
|
2015-10-22 18:48:04 +02:00
|
|
|
virtual std::string createKey(cpputils::RandomGenerator &randomGenerator) const = 0;
|
2015-09-01 00:25:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CryCiphers {
|
|
|
|
public:
|
2015-09-04 16:02:55 +02:00
|
|
|
static std::vector<std::string> supportedCipherNames();
|
2015-09-01 00:25:14 +02:00
|
|
|
|
|
|
|
static const CryCipher& find(const std::string &cipherName);
|
|
|
|
|
|
|
|
private:
|
2015-10-19 14:22:01 +02:00
|
|
|
static const std::string INTEGRITY_WARNING;
|
|
|
|
|
2015-09-01 00:25:14 +02:00
|
|
|
static const std::vector<std::shared_ptr<CryCipher>> SUPPORTED_CIPHERS;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|