8#include <botan/prf_x942.h>
9#include <botan/der_enc.h>
10#include <botan/hash.h>
11#include <botan/loadstor.h>
21std::vector<uint8_t> encode_x942_int(uint32_t n)
23 uint8_t n_buf[4] = { 0 };
26 std::vector<uint8_t> output;
34 const uint8_t secret[],
size_t secret_len,
35 const uint8_t salt[],
size_t salt_len,
36 const uint8_t label[],
size_t label_len)
const
46 in += std::make_pair(label,label_len);
49 while(offset != key_len && counter)
51 hash->update(secret, secret_len);
57 .encode(m_key_wrap_oid)
58 .raw_bytes(encode_x942_int(counter))
69 .raw_bytes(encode_x942_int(
static_cast<uint32_t
>(8 * key_len)))
72 .end_cons().get_contents()
76 const size_t copied = std::min(h.size(), key_len - offset);
77 copy_mem(&key[offset], h.data(), copied);
static std::unique_ptr< HashFunction > create(const std::string &algo_spec, const std::string &provider="")
std::string to_formatted_string() const
size_t kdf(uint8_t key[], size_t key_len, const uint8_t secret[], size_t secret_len, const uint8_t salt[], size_t salt_len, const uint8_t label[], size_t label_len) const override
std::string name() const override
void store_be(uint16_t in, uint8_t out[2])
void copy_mem(T *out, const T *in, size_t n)
std::vector< T, secure_allocator< T > > secure_vector