diff options
author | lloyd <[email protected]> | 2008-11-09 17:48:47 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-11-09 17:48:47 +0000 |
commit | 8b12f78f1a1f9d861a0e0b7dd8f7f53b6f2d1459 (patch) | |
tree | 39fe575753dd4c1c5a50a3c644258ef77ade09dd /src/pbe/pbes2/pbes2.cpp | |
parent | 2dada64d07767d7794d0f325b2df99b090ecc758 (diff) |
Remove use of get_s2k in PBES1 and PBES2, since they both always wanted
a particular algorithm (PBKDF1 or PBKDF2, resp), only variation is the has
function to use.
Diffstat (limited to 'src/pbe/pbes2/pbes2.cpp')
-rw-r--r-- | src/pbe/pbes2/pbes2.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp index 136ebc393..e4e4585fe 100644 --- a/src/pbe/pbes2/pbes2.cpp +++ b/src/pbe/pbes2/pbes2.cpp @@ -4,11 +4,13 @@ *************************************************/ #include <botan/pbes2.h> +#include <botan/pbkdf2.h> +#include <botan/hmac.h> +#include <botan/lookup.h> #include <botan/libstate.h> #include <botan/der_enc.h> #include <botan/ber_dec.h> #include <botan/parsing.h> -#include <botan/lookup.h> #include <botan/asn1_obj.h> #include <botan/oids.h> #include <algorithm> @@ -72,10 +74,11 @@ void PBE_PKCS5v20::flush_pipe(bool safe_to_skip) *************************************************/ void PBE_PKCS5v20::set_key(const std::string& passphrase) { - std::auto_ptr<S2K> pbkdf(get_s2k("PBKDF2(" + digest + ")")); - pbkdf->set_iterations(iterations); - pbkdf->change_salt(salt, salt.size()); - key = pbkdf->derive_key(key_length, passphrase).bits_of(); + PKCS5_PBKDF2 pbkdf(new HMAC(get_hash(digest))); + + pbkdf.set_iterations(iterations); + pbkdf.change_salt(salt, salt.size()); + key = pbkdf.derive_key(key_length, passphrase).bits_of(); } /************************************************* |