Skip to content

Doubts about the usage of HMAC_DRBG #4388

Answered by reneme
crypto-int asked this question in Q&A
Discussion options

You must be logged in to vote

Botan::HMAC_DRBG has an .initialize_with() method exactly for this use case. This method takes a single parameter "input" that is a byte array of "seed material" as required in NIST SP.800-90A Section 10.1.2.3. Here's some code to illustrate this usage:

#include <botan/hex.h>
#include <botan/hmac_drbg.h>
#include <botan/system_rng.h>

#include <iostream>
#include <ranges>

auto as_bytes(std::string_view s) {
   const auto start = reinterpret_cast<const uint8_t*>(s.data());
   const auto end = start + s.size();
   return std::vector<uint8_t>(start, end);
}

template <std::ranges::input_range... Ts>
   requires(std::same_as<uint8_t, std::ranges::range_value_t<Ts>> && ...)
constexpr auto con…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@crypto-int
Comment options

@reneme
Comment options

Comment options

You must be logged in to vote
1 reply
@crypto-int
Comment options

Answer selected by crypto-int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants