aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 16:58:34 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-11-22 16:58:34 -0800
commitb7e8990aabb46ac6c0511530d7a67f69e08f1788 (patch)
tree10e3c439ad53412d1bb2b42c69f7050f25d2cfd7
parentbae899ad36bcb99dbec94aaf026ef1650f2b1242 (diff)
downloadcryptography-b7e8990aabb46ac6c0511530d7a67f69e08f1788.tar.gz
cryptography-b7e8990aabb46ac6c0511530d7a67f69e08f1788.tar.bz2
cryptography-b7e8990aabb46ac6c0511530d7a67f69e08f1788.zip
Useful error message
-rw-r--r--cryptography/hazmat/bindings/openssl/backend.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/cryptography/hazmat/bindings/openssl/backend.py b/cryptography/hazmat/bindings/openssl/backend.py
index b2599d22..9f8ea939 100644
--- a/cryptography/hazmat/bindings/openssl/backend.py
+++ b/cryptography/hazmat/bindings/openssl/backend.py
@@ -205,10 +205,16 @@ class Backend(object):
if lib == self.lib.ERR_LIB_EVP:
if func == self.lib.EVP_F_EVP_ENCRYPTFINAL_EX:
if reason == self.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH:
- raise ValueError
+ raise ValueError(
+ "The length of the provided data is not a multiple of "
+ "the block length"
+ )
elif func == self.lib.EVP_F_EVP_DECRYPTFINAL_EX:
if reason == self.lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH:
- raise ValueError
+ raise ValueError(
+ "The length of the provided data is not a multiple of "
+ "the block length"
+ )
raise SystemError(
"Unknown error code from OpenSSL, you should probably file a bug."