aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/misc/pbes2/pbes2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/misc/pbes2/pbes2.cpp b/src/lib/misc/pbes2/pbes2.cpp
index ab740ff5d..470e33cb0 100644
--- a/src/lib/misc/pbes2/pbes2.cpp
+++ b/src/lib/misc/pbes2/pbes2.cpp
@@ -81,6 +81,9 @@ pbes2_encrypt(const secure_vector<byte>& key_bits,
std::unique_ptr<Cipher_Mode> enc(get_cipher_mode(cipher, ENCRYPTION));
+ if(!enc)
+ throw Decoding_Error("PBE-PKCS5 cannot decrypt no cipher " + cipher);
+
std::unique_ptr<PBKDF> pbkdf(get_pbkdf("PBKDF2(" + prf + ")"));
const size_t key_length = enc->key_spec().maximum_keylength();