aboutsummaryrefslogtreecommitdiffstats
path: root/src/pbe
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-06-15 20:15:52 +0000
committerlloyd <[email protected]>2010-06-15 20:15:52 +0000
commit72f7d1292bf9a38013e9f69a7db4fa262064795c (patch)
tree0f168cf718ef85a334faacb1bfc4bbbd66a97dd8 /src/pbe
parent6565cf0df1ed88a818aecf6de7635531e05c0871 (diff)
Increase the iteration count and salt size used for encrypted
private keys. For the older PBES1, we can only increase the iteration count (from 2048 to 10000); the salt is fixed by the standard to 64 bits. This is probably OK, since PBES1 is also limited to (at best) 64-bit encryption keys and thus is pretty unsafe anyway. For PBES2, increase the iteration count (also 2048 to 10000) and increase the size of the salt from 64 bits to 96 bits. This will only affect keys which are encrypted by a version after this revision.
Diffstat (limited to 'src/pbe')
-rw-r--r--src/pbe/pbes1/pbes1.cpp2
-rw-r--r--src/pbe/pbes2/pbes2.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/pbe/pbes1/pbes1.cpp b/src/pbe/pbes1/pbes1.cpp
index 36cfaa6b4..a3e08d679 100644
--- a/src/pbe/pbes1/pbes1.cpp
+++ b/src/pbe/pbes1/pbes1.cpp
@@ -93,7 +93,7 @@ void PBE_PKCS5v15::set_key(const std::string& passphrase)
*/
void PBE_PKCS5v15::new_params(RandomNumberGenerator& rng)
{
- iterations = 2048;
+ iterations = 10000;
salt.resize(8);
rng.randomize(salt, salt.size());
}
diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp
index 79d4dfadf..4a28193e1 100644
--- a/src/pbe/pbes2/pbes2.cpp
+++ b/src/pbe/pbes2/pbes2.cpp
@@ -97,10 +97,10 @@ void PBE_PKCS5v20::set_key(const std::string& passphrase)
*/
void PBE_PKCS5v20::new_params(RandomNumberGenerator& rng)
{
- iterations = 2048;
+ iterations = 10000;
key_length = block_cipher->MAXIMUM_KEYLENGTH;
- salt.resize(8);
+ salt.resize(12);
rng.randomize(salt, salt.size());
iv.resize(block_cipher->BLOCK_SIZE);