aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2013-08-15 14:06:24 +0000
committerlloyd <[email protected]>2013-08-15 14:06:24 +0000
commite614a76c952107150ba0d4994954e6d77701fa17 (patch)
tree77de38187b841b93ebfce3cc1b35f62c3969bdd1
parent920bd7b871bb2a982b6db7e75aaa5da69e37a3c9 (diff)
Avoid using CBC filters directly in PBES
-rw-r--r--src/pbe/pbes1/pbes1.cpp12
-rw-r--r--src/pbe/pbes2/pbes2.cpp12
2 files changed, 6 insertions, 18 deletions
diff --git a/src/pbe/pbes1/pbes1.cpp b/src/pbe/pbes1/pbes1.cpp
index e86a496ac..a30f10a6c 100644
--- a/src/pbe/pbes1/pbes1.cpp
+++ b/src/pbe/pbes1/pbes1.cpp
@@ -9,7 +9,7 @@
#include <botan/pbkdf1.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/cbc.h>
+#include <botan/lookup.h>
#include <algorithm>
namespace Botan {
@@ -28,14 +28,8 @@ void PBE_PKCS5v15::write(const byte input[], size_t length)
*/
void PBE_PKCS5v15::start_msg()
{
- if(m_direction == ENCRYPTION)
- m_pipe.append(new CBC_Encryption(m_block_cipher->clone(),
- new PKCS7_Padding,
- m_key, m_iv));
- else
- m_pipe.append(new CBC_Decryption(m_block_cipher->clone(),
- new PKCS7_Padding,
- m_key, m_iv));
+ m_pipe.append(get_cipher(m_block_cipher->name() + "/CBC/PKCS7",
+ m_key, m_iv, m_direction));
m_pipe.start_msg();
if(m_pipe.message_count() > 1)
diff --git a/src/pbe/pbes2/pbes2.cpp b/src/pbe/pbes2/pbes2.cpp
index b27ad445e..d4df1277c 100644
--- a/src/pbe/pbes2/pbes2.cpp
+++ b/src/pbe/pbes2/pbes2.cpp
@@ -7,7 +7,6 @@
#include <botan/pbes2.h>
#include <botan/pbkdf2.h>
-#include <botan/cbc.h>
#include <botan/algo_factory.h>
#include <botan/libstate.h>
#include <botan/der_enc.h>
@@ -15,6 +14,7 @@
#include <botan/parsing.h>
#include <botan/alg_id.h>
#include <botan/oids.h>
+#include <botan/lookup.h>
#include <algorithm>
#include <memory>
@@ -34,14 +34,8 @@ void PBE_PKCS5v20::write(const byte input[], size_t length)
*/
void PBE_PKCS5v20::start_msg()
{
- if(direction == ENCRYPTION)
- pipe.append(new CBC_Encryption(block_cipher->clone(),
- new PKCS7_Padding,
- key, iv));
- else
- pipe.append(new CBC_Decryption(block_cipher->clone(),
- new PKCS7_Padding,
- key, iv));
+ pipe.append(get_cipher(block_cipher->name() + "/CBC/PKCS7",
+ key, iv, direction));
pipe.start_msg();
if(pipe.message_count() > 1)