nil::crypto3::pbkdf::pgp_s2k< Hash > Class Template Reference
OpenPGP's S2K. More...
#include <pgp_s2k.hpp>
Collaboration diagram for nil::crypto3::pbkdf::pgp_s2k< Hash >:
Public Types | |
typedef policy_type::digest_type | digest_type |
typedef policy_type::hash_type | hash_type |
typedef policy_type::salt_type | salt_type |
Public Member Functions | |
std::size_t | derive (digest_type &digest, const std::string &passphrase, const salt_type &salt, size_t iterations, std::chrono::milliseconds msec) const override |
Static Public Attributes | |
constexpr static const std::size_t | digest_bits = policy_type::digest_bits |
constexpr static const std::size_t | salt_bits = policy_type::salt_bits |
Detailed Description
template<typename Hash>
class nil::crypto3::pbkdf::pgp_s2k< Hash >
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.
- Template Parameters
-
Hash
Member Typedef Documentation
◆ digest_type
template<typename Hash >
typedef policy_type::digest_type nil::crypto3::pbkdf::pgp_s2k< Hash >::digest_type |
◆ hash_type
template<typename Hash >
typedef policy_type::hash_type nil::crypto3::pbkdf::pgp_s2k< Hash >::hash_type |
◆ salt_type
template<typename Hash >
typedef policy_type::salt_type nil::crypto3::pbkdf::pgp_s2k< Hash >::salt_type |
Member Function Documentation
◆ derive()
template<typename Hash >
|
inlineoverride |
Member Data Documentation
◆ digest_bits
template<typename Hash >
|
staticconstexpr |
◆ salt_bits
template<typename Hash >
|
staticconstexpr |
The documentation for this class was generated from the following file: