8 #include <botan/prf_x942.h> 9 #include <botan/der_enc.h> 10 #include <botan/oids.h> 11 #include <botan/sha160.h> 12 #include <botan/loadstor.h> 23 MemoryVector<byte> encode_x942_int(
u32bit n)
25 byte n_buf[4] = { 0 };
27 return DER_Encoder().encode(n_buf, 4,
OCTET_STRING).get_contents();
36 const byte secret[],
size_t secret_len,
37 const byte salt[],
size_t salt_len)
const 40 const OID kek_algo(key_wrap_oid);
45 while(key.
size() != key_len && counter)
47 hash.
update(secret, secret_len);
54 .raw_bytes(encode_x942_int(counter))
57 .encode_if(salt_len != 0,
65 .raw_bytes(encode_x942_int(static_cast<u32bit>(8 * key_len)))
68 .end_cons().get_contents()
73 key += std::make_pair(&digest[0], needed);
std::string lookup(const OID &oid)
void update(const byte in[], size_t length)
X942_PRF(const std::string &oid)
SecureVector< byte > derive(size_t, const byte[], size_t, const byte[], size_t) const
std::string encode(const byte der[], size_t length, const std::string &label, size_t width)
void store_be(u16bit in, byte out[2])
bool have_oid(const std::string &name)