本文整理汇总了C++中key_type::data方法的典型用法代码示例。如果您正苦于以下问题:C++ key_type::data方法的具体用法?C++ key_type::data怎么用?C++ key_type::data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类key_type
的用法示例。
在下文中一共展示了key_type::data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hkdf
FileBase::FileBase(int data_fd, int meta_fd, const key_type& key_, const id_type& id_, bool check)
: m_lock()
, m_refcount(1)
, m_header()
, m_id(id_)
, m_data_fd(data_fd)
, m_meta_fd(meta_fd)
, m_dirty(false)
, m_check(check)
, m_stream()
, m_removed(false)
{
auto data_stream = std::make_shared<POSIXFileStream>(data_fd);
auto meta_stream = std::make_shared<POSIXFileStream>(meta_fd);
key_type data_key, meta_key;
byte generated_keys[KEY_LENGTH * 3];
hkdf(key_.data(),
key_.size(),
nullptr,
0,
id_.data(),
id_.size(),
generated_keys,
sizeof(generated_keys));
memcpy(data_key.data(), generated_keys, KEY_LENGTH);
memcpy(meta_key.data(), generated_keys + KEY_LENGTH, KEY_LENGTH);
memcpy(m_key.data(), generated_keys + 2 * KEY_LENGTH, KEY_LENGTH);
auto crypt = make_cryptstream_aes_gcm(
std::move(data_stream), std::move(meta_stream), data_key, meta_key, id_, check);
m_stream = crypt.first;
m_header = crypt.second;
read_header();
}
示例2: operator
void operator()(const key_type &key, std::array<M128I<U>, Rp1> &rk) const
{
M128I<std::uint64_t> weyl;
weyl.set(
ARSWeylConstantTrait<1>::value, ARSWeylConstantTrait<0>::value);
std::get<0>(rk).load(key.data());
generate<1>(rk, weyl, std::integral_constant<bool, 1 < Rp1>());
}
示例3: InvalidArgumentException
FileTable::FileTable(int version,
std::shared_ptr<FileSystemService> root,
const key_type& master_key,
uint32_t flags,
unsigned block_size,
unsigned iv_size)
: m_flags(flags), m_block_size(block_size), m_iv_size(iv_size), m_root(root)
{
memcpy(m_master_key.data(), master_key.data(), master_key.size());
switch (version)
{
case 1:
m_fio.reset(new FileTableIOVersion1(root, is_readonly()));
break;
case 2:
m_fio.reset(new FileTableIOVersion2(root, is_readonly()));
break;
default:
throw InvalidArgumentException("Unknown version");
}
}
示例4: table
#include <vector>
#include <algorithm>
#include <set>
#include <fcntl.h>
#include <unistd.h>
TEST_CASE("File table")
{
using namespace securefs;
char dir_template[] = "/tmp/securefs_file_table.XXXXXXX";
mkdtemp(dir_template);
key_type master_key;
id_type null_id, file_id;
memset(master_key.data(), 0xFF, master_key.size());
memset(null_id.data(), 0, null_id.size());
memset(file_id.data(), 0xEE, file_id.size());
const char* xattr_name = "com.apple.FinderInfo...";
const securefs::PODArray<char, 32> xattr_value(0x11);
{
int tmp_fd = ::open(dir_template, O_RDONLY);
REQUIRE(tmp_fd >= 0);
FileTable table(tmp_fd, master_key, 0);
auto dir = dynamic_cast<Directory*>(table.create_as(null_id, FileBase::DIRECTORY));
dir->add_entry(".", null_id, FileBase::DIRECTORY);
dir->add_entry("..", null_id, FileBase::DIRECTORY);
dir->add_entry("hello", file_id, FileBase::REGULAR_FILE);
try
{
示例5: get
// The get function is required by the property map concept.
friend reference get(const Extended_face_property_map& /* map */,
key_type key)
{
return key->data();
}
示例6: find
/*!
* The method finds the attribute value by name.
*
* \param key Attribute name.
* \return Iterator to the found element or \c end() if the attribute with such name is not found.
*/
const_iterator find(key_type const& key) const
{
return find_impl(key.data(), key.size());
}