aboutsummaryrefslogtreecommitdiffstats
path: root/src/pbe
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-29 15:15:30 +0000
committerlloyd <[email protected]>2010-10-29 15:15:30 +0000
commit66b163323d39ac5c0be30fd0b1c0fd91b64a55f3 (patch)
treee745b4824105f600ec5452e591a112229bc01478 /src/pbe
parent89a2e78d2ff2f0266825708a0294b13a4c370a29 (diff)
Make MemoryRegion::set protected, change all callers
Diffstat (limited to 'src/pbe')
-rw-r--r--src/pbe/pbes1/pbes1.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/pbe/pbes1/pbes1.cpp b/src/pbe/pbes1/pbes1.cpp
index 994b02d0a..ec5ebb253 100644
--- a/src/pbe/pbes1/pbes1.cpp
+++ b/src/pbe/pbes1/pbes1.cpp
@@ -80,12 +80,14 @@ void PBE_PKCS5v15::set_key(const std::string& passphrase)
{
PKCS5_PBKDF1 pbkdf(hash_function->clone());
- SymmetricKey key_and_iv = pbkdf.derive_key(16, passphrase,
- &salt[0], salt.size(),
- iterations);
-
- key.set(key_and_iv.begin(), 8);
- iv.set(key_and_iv.begin() + 8, 8);
+ SecureVector<byte> key_and_iv = pbkdf.derive_key(16, passphrase,
+ &salt[0], salt.size(),
+ iterations).bits_of();
+
+ key.resize(8);
+ iv.resize(8);
+ copy_mem(&key[0], &key_and_iv[0], 8);
+ copy_mem(&iv[0], &key_and_iv[8], 8);
}
/*