Botan 3.6.1
Crypto and TLS for C&
|
#include <pgp_s2k.h>
Public Member Functions | |
PBKDF * | clone () const |
template<typename Alloc > | |
OctetString | derive_key (size_t out_len, std::string_view passphrase, const std::vector< uint8_t, Alloc > &salt, size_t iterations) const |
template<typename Alloc > | |
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 |
OctetString | derive_key (size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations) const |
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 |
std::string | name () const override |
std::unique_ptr< PBKDF > | new_object () const override |
OpenPGP_S2K (std::unique_ptr< HashFunction > hash) | |
size_t | pbkdf (uint8_t output_buf[], size_t output_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec) const override |
secure_vector< uint8_t > | pbkdf_iterations (size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations) const |
void | pbkdf_iterations (uint8_t out[], size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, size_t iterations) const |
secure_vector< uint8_t > | pbkdf_timed (size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, std::chrono::milliseconds msec, size_t &iterations) const |
void | pbkdf_timed (uint8_t out[], size_t out_len, std::string_view passphrase, const uint8_t salt[], size_t salt_len, std::chrono::milliseconds msec, size_t &iterations) const |
Static Public Member Functions | |
static std::unique_ptr< PBKDF > | create (std::string_view algo_spec, std::string_view provider="") |
static std::unique_ptr< PBKDF > | create_or_throw (std::string_view algo_spec, std::string_view provider="") |
static size_t | decode_count (uint8_t encoded_iter) |
static uint8_t | encode_count (size_t iterations) |
static std::vector< std::string > | providers (std::string_view algo_spec) |
OpenPGP's S2K
See RFC 4880 sections 3.7.1.1, 3.7.1.2, and 3.7.1.3 If the salt is empty and iterations == 1, "simple" S2K is used If the salt is non-empty and iterations == 1, "salted" S2K is used If the salt is non-empty and iterations > 1, "iterated" S2K is used
Due to complexities of the PGP S2K algorithm, time-based derivation is not supported. So if iterations == 0 and msec.count() > 0, an exception is thrown. In the future this may be supported, in which case "iterated" S2K will be used and the number of iterations performed is returned.
Note that unlike PBKDF2, OpenPGP S2K's "iterations" are defined as the number of bytes hashed.
|
inlineexplicit |
|
inlineinherited |
|
staticinherited |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to choose |
Definition at line 23 of file pbkdf.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_count(), BOTAN_UNUSED, Botan::HashFunction::create(), and Botan::MessageAuthenticationCode::create().
Referenced by Botan::PBKDF::create_or_throw().
|
staticinherited |
Create an instance based on a name, or throw if the algo/provider combination cannot be found. If provider is empty then best available is chosen.
Definition at line 59 of file pbkdf.cpp.
References Botan::PBKDF::create(), and Botan::PBKDF::pbkdf().
|
inlinestatic |
|
inlineinherited |
Derive a key from a passphrase
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
iterations | the number of iterations to use (use 10K or more) |
Definition at line 188 of file pbkdf.h.
|
inlineinherited |
Derive a key from a passphrase using a certain amount of time
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
msec | is how long to run the PBKDF |
iterations | is set to the number of iterations used |
Definition at line 222 of file pbkdf.h.
|
inlineinherited |
Derive a key from a passphrase
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
iterations | the number of iterations to use (use 10K or more) |
Definition at line 175 of file pbkdf.h.
Referenced by Botan::check_passhash9(), and Botan::generate_passhash9().
|
inlineinherited |
Derive a key from a passphrase
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
msec | is how long to run the PBKDF |
iterations | is set to the number of iterations used |
Definition at line 204 of file pbkdf.h.
|
inlinestatic |
RFC 4880 encodes the iteration count to a single-byte value
Definition at line 61 of file pgp_s2k.h.
References Botan::RFC4880_encode_count().
|
inlineoverridevirtual |
Implements Botan::PBKDF.
Definition at line 46 of file pgp_s2k.h.
|
inlineoverridevirtual |
Implements Botan::PBKDF.
Definition at line 48 of file pgp_s2k.h.
|
overridevirtual |
Derive a key from a passphrase for a number of iterations specified by either iterations or if iterations == 0 then running until msec time has elapsed.
out | buffer to store the derived key, must be of out_len bytes |
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
iterations | the number of iterations to use (use 10K or more) |
msec | if iterations is zero, then instead the PBKDF is run until msec milliseconds has passed. |
Implements Botan::PBKDF.
Definition at line 71 of file pgp_s2k.cpp.
References Botan::RFC4880_S2K_Family::tune().
|
inherited |
Derive a key from a passphrase for a number of iterations.
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
iterations | the number of iterations to use (use 10K or more) |
Definition at line 95 of file pbkdf.cpp.
References Botan::PBKDF::pbkdf_iterations().
|
inherited |
Derive a key from a passphrase for a number of iterations.
out | buffer to store the derived key, must be of out_len bytes |
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
iterations | the number of iterations to use (use 10K or more) |
Definition at line 80 of file pbkdf.cpp.
References BOTAN_ASSERT_EQUAL, Botan::PBKDF::name(), and Botan::PBKDF::pbkdf().
Referenced by Botan::PBKDF::pbkdf_iterations().
|
inherited |
Derive a key from a passphrase, running until msec time has elapsed.
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
msec | if iterations is zero, then instead the PBKDF is run until msec milliseconds has passed. |
iterations | set to the number iterations executed |
Definition at line 102 of file pbkdf.cpp.
References Botan::PBKDF::pbkdf_timed().
|
inherited |
Derive a key from a passphrase, running until msec time has elapsed.
out | buffer to store the derived key, must be of out_len bytes |
out_len | the desired length of the key to produce |
passphrase | the password to derive the key from |
salt | a randomly chosen salt |
salt_len | length of salt in bytes |
msec | if iterations is zero, then instead the PBKDF is run until msec milliseconds has passed. |
iterations | set to the number iterations executed |
Definition at line 70 of file pbkdf.cpp.
References Botan::PBKDF::pbkdf().
Referenced by Botan::PBKDF::pbkdf_timed().
|
staticinherited |
Definition at line 66 of file pbkdf.cpp.
References Botan::probe_providers_of().