Improve KDM decryption error message again.
authorCarl Hetherington <cth@carlh.net>
Fri, 15 Dec 2017 15:39:39 +0000 (15:39 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 15 Dec 2017 15:39:39 +0000 (15:39 +0000)
src/decrypted_kdm.cc
src/exceptions.cc
src/exceptions.h

index d0e2cc0dc110149a50182169920dd373f2dcd3d7..6147439ad2045cd94bb54d32729d25887c56893e 100644 (file)
@@ -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;
index 51dd6b0104db6990da3943d430022d891a98e1c3..71771b1c1248a8d80b595de17a46eb7f04fdd946 100644 (file)
@@ -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))
 {
 
 }
index fb17801f4fbbb09b760c0b1a867f6cc6058d7066..f187df1c820f62e508c4afdc05217e54176450dd 100644 (file)
@@ -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