Pass through crypto exceptions

This commit is contained in:
Kijin Sung 2017-05-07 15:29:21 +09:00
parent 865e34c0d0
commit 8c797aaba1

View file

@ -60,14 +60,7 @@ class Security
// Use defuse/php-encryption if possible.
if (!$force_compat && function_exists('openssl_encrypt'))
{
try
{
return base64_encode(\Crypto::Encrypt($plaintext, $key));
}
catch (\Exception $e)
{
return false;
}
return base64_encode(\Crypto::Encrypt($plaintext, $key));
}
// Otherwise, use the CryptoCompat class.
@ -102,7 +95,7 @@ class Security
{
return \Crypto::Decrypt($ciphertext, $key);
}
catch (\Exception $e)
catch (\InvalidCiphertextException $e)
{
return false;
}