aboutsummaryrefslogtreecommitdiffstats
path: root/src/pbe/pbes2/pbes2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/pbe/pbes2/pbes2.cpp')
-rw-r--r--src/pbe/pbes2/pbes2.cpp13
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();
}
/*************************************************