11#include <botan/symkey.h>
41 static std::unique_ptr<PBKDF> create(std::string_view algo_spec, std::string_view provider =
"");
49 static std::unique_ptr<PBKDF> create_or_throw(std::string_view algo_spec, std::string_view provider =
"");
54 static std::vector<std::string> providers(std::string_view algo_spec);
64 PBKDF*
clone()
const {
return this->new_object().release(); }
69 virtual std::string
name()
const = 0;
88 virtual size_t pbkdf(uint8_t out[],
90 std::string_view passphrase,
94 std::chrono::milliseconds msec)
const = 0;
106 void pbkdf_iterations(uint8_t out[],
108 std::string_view passphrase,
109 const uint8_t salt[],
111 size_t iterations)
const;
125 void pbkdf_timed(uint8_t out[],
127 std::string_view passphrase,
128 const uint8_t salt[],
130 std::chrono::milliseconds msec,
131 size_t& iterations)
const;
144 size_t out_len, std::string_view passphrase,
const uint8_t salt[],
size_t salt_len,
size_t iterations)
const;
159 std::string_view passphrase,
160 const uint8_t salt[],
162 std::chrono::milliseconds msec,
163 size_t& iterations)
const;
176 size_t out_len, std::string_view passphrase,
const uint8_t salt[],
size_t salt_len,
size_t iterations)
const {
177 return OctetString(pbkdf_iterations(out_len, passphrase, salt, salt_len, iterations));
187 template <
typename Alloc>
189 std::string_view passphrase,
190 const std::vector<uint8_t, Alloc>& salt,
191 size_t iterations)
const {
192 return OctetString(pbkdf_iterations(out_len, passphrase, salt.data(), salt.size(), iterations));
205 std::string_view passphrase,
206 const uint8_t salt[],
208 std::chrono::milliseconds msec,
209 size_t& iterations)
const {
210 return OctetString(pbkdf_timed(out_len, passphrase, salt, salt_len, msec, iterations));
221 template <
typename Alloc>
223 std::string_view passphrase,
224 const std::vector<uint8_t, Alloc>& salt,
225 std::chrono::milliseconds msec,
226 size_t& iterations)
const {
227 return OctetString(pbkdf_timed(out_len, passphrase, salt.data(), salt.size(), msec, iterations));
243inline
PBKDF* get_pbkdf(std::string_view algo_spec, std::string_view provider = "") {
244 return PBKDF::create_or_throw(algo_spec, provider).release();
248 return PBKDF::create_or_throw(algo_spec).release();
OctetString derive_key(size_t out_len, std::string_view passphrase, const std::vector< uint8_t, Alloc > &salt, size_t iterations) const
OctetString derive_key(size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations) const
virtual std::unique_ptr< PBKDF > new_object() const =0
virtual size_t pbkdf(uint8_t out[], size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec) const =0
virtual std::string name() const =0
OctetString derive_key(size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, std::chrono::milliseconds msec, size_t &iterations) const
OctetString derive_key(size_t out_len, std::string_view passphrase, const std::vector< uint8_t, Alloc > &salt, std::chrono::milliseconds msec, size_t &iterations) const
#define BOTAN_DEPRECATED_HEADER(hdr)
#define BOTAN_PUBLIC_API(maj, min)
#define BOTAN_DEPRECATED(msg)
std::vector< T, secure_allocator< T > > secure_vector