diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-12-15 15:39:39 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-12-15 15:39:39 +0000 |
| commit | 60299c4e299c6efe9d516ede7e8fa732646a3de0 (patch) | |
| tree | 20ef60df8e347a068a082628f884dc7cc7568424 /src | |
| parent | 9bcc4e7b7099b07677d77fe9ea52330fc93c7aa7 (diff) | |
Improve KDM decryption error message again.
Diffstat (limited to 'src')
| -rw-r--r-- | src/decrypted_kdm.cc | 2 | ||||
| -rw-r--r-- | src/exceptions.cc | 4 | ||||
| -rw-r--r-- | src/exceptions.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index d0e2cc0d..6147439a 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -153,7 +153,7 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key) int const decrypted_len = RSA_private_decrypt (cipher_value_len, cipher_value, decrypted, rsa, RSA_PKCS1_OAEP_PADDING); if (decrypted_len == -1) { delete[] decrypted; - throw KDMDecryptionError (ERR_error_string (ERR_get_error(), 0)); + throw KDMDecryptionError (ERR_error_string (ERR_get_error(), 0), cipher_value_len, rsa->n->dmax); } unsigned char* p = decrypted; diff --git a/src/exceptions.cc b/src/exceptions.cc index 51dd6b01..71771b1c 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -91,8 +91,8 @@ MismatchedStandardError::MismatchedStandardError () } -KDMDecryptionError::KDMDecryptionError (std::string message) - : runtime_error (String::compose ("Could not decrypt KDM (%1)", message)) +KDMDecryptionError::KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax) + : runtime_error (String::compose ("Could not decrypt KDM (%1) (%2/%3)", message, cipher_length, modulus_dmax)) { } diff --git a/src/exceptions.h b/src/exceptions.h index fb17801f..f187df1c 100644 --- a/src/exceptions.h +++ b/src/exceptions.h @@ -176,7 +176,7 @@ public: class KDMDecryptionError : public std::runtime_error { public: - KDMDecryptionError (std::string message); + KDMDecryptionError (std::string message, int cipher_length, int modulus_dmax); }; class KDMFormatError : public std::runtime_error |
