本文整理汇总了C++中CryConfig::Cipher方法的典型用法代码示例。如果您正苦于以下问题:C++ CryConfig::Cipher方法的具体用法?C++ CryConfig::Cipher怎么用?C++ CryConfig::Cipher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CryConfig
的用法示例。
在下文中一共展示了CryConfig::Cipher方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
CryConfig CryConfigCreator::create(const optional<string> &cipherFromCommandLine) {
CryConfig config;
config.SetCipher(_generateCipher(cipherFromCommandLine));
config.SetEncryptionKey(_generateEncKey(config.Cipher()));
config.SetRootBlob(_generateRootBlobKey());
return config;
}
示例2: create
CryConfig CryConfigCreator::create(const optional<string> &cipherFromCommandLine, const optional<uint32_t> &blocksizeBytesFromCommandLine) {
CryConfig config;
config.SetCipher(_generateCipher(cipherFromCommandLine));
config.SetVersion(gitversion::VersionString());
config.SetCreatedWithVersion(gitversion::VersionString());
config.SetBlocksizeBytes(_generateBlocksizeBytes(blocksizeBytesFromCommandLine));
config.SetRootBlob(_generateRootBlobKey());
config.SetEncryptionKey(_generateEncKey(config.Cipher()));
config.SetFilesystemId(_generateFilesystemID());
return config;
}
示例3:
TEST_P(CryConfigCreatorTest_ChooseCipher, ChoosesCipherCorrectly) {
if (cipherWarning == none) {
EXPECT_DONT_SHOW_WARNING();
} else {
EXPECT_SHOW_WARNING(*cipherWarning);
}
EXPECT_ASK_FOR_CIPHER().WillOnce(ChooseCipher(cipherName));
CryConfig config = creator.create(none);
EXPECT_EQ(cipherName, config.Cipher());
}
示例4: CryConfigFile
optional<CryConfigFile> CryConfigFile::load(const bf::path &path, const string &password) {
auto encryptedConfigData = Data::LoadFromFile(path);
if (encryptedConfigData == none) {
LOG(ERROR) << "Config file not found";
return none;
}
auto encryptor = CryConfigEncryptorFactory::loadKey(*encryptedConfigData, password);
if (encryptor == none) {
return none;
}
auto decrypted = (*encryptor)->decrypt(*encryptedConfigData);
if (decrypted == none) {
return none;
}
CryConfig config = CryConfig::load(decrypted->data);
if (config.Cipher() != decrypted->cipherName) {
LOG(ERROR) << "Inner cipher algorithm used to encrypt config file doesn't match config value";
return none;
}
return CryConfigFile(path, std::move(config), std::move(*encryptor));
}
示例5: SaveAndLoad
TEST_F(CryConfigTest, Cipher_AfterSaveAndLoad) {
cfg.SetCipher("mycipher");
CryConfig loaded = SaveAndLoad(std::move(cfg));
EXPECT_EQ("mycipher", loaded.Cipher());
}
示例6:
TEST_F(CryConfigTest, Cipher_AfterMove) {
cfg.SetCipher("mycipher");
CryConfig moved = std::move(cfg);
EXPECT_EQ("mycipher", moved.Cipher());
}
示例7: _checkCipher
void CryConfigLoader::_checkCipher(const CryConfig &config) const {
if (_cipherFromCommandLine != none && config.Cipher() != *_cipherFromCommandLine) {
throw std::runtime_error(string() + "Filesystem uses " + config.Cipher() + " cipher and not " + *_cipherFromCommandLine + " as specified.");
}
}
示例8: find
cpputils::unique_ref<blockstore::BlockStore> CryDevice::CreateEncryptedBlockStore(const CryConfig &config, unique_ref<BlockStore> baseBlockStore) {
//TODO Test that CryFS is using the specified cipher
return CryCiphers::find(config.Cipher()).createEncryptedBlockstore(std::move(baseBlockStore), config.EncryptionKey());
}