diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-01-22 20:42:11 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-01-22 21:19:41 +0300 |
commit | 16c833fe068217c36256545a5da80330ac4e5ad0 (patch) | |
tree | ff7ef20b160ead9a6bcbc68c27636fe68e6b36b1 /libraries | |
parent | 8577e70888ef08a2d4dd2d013da7dc3327c9976f (diff) |
Fix CoreTest failing tests
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/classes/Crypto/Crypto.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libraries/classes/Crypto/Crypto.php b/libraries/classes/Crypto/Crypto.php index 6449f7dca5..f0ef18ec5d 100644 --- a/libraries/classes/Crypto/Crypto.php +++ b/libraries/classes/Crypto/Crypto.php @@ -2,6 +2,7 @@ namespace PhpMyAdmin\Crypto; +use Exception; use phpseclib\Crypt\AES; use phpseclib\Crypt\Random; @@ -145,7 +146,12 @@ final class Crypto $key = $this->getEncryptionKey(); $nonce = mb_substr($encrypted, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, '8bit'); $ciphertext = mb_substr($encrypted, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null, '8bit'); - $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, $key); + try { + $decrypted = sodium_crypto_secretbox_open($ciphertext, $nonce, $key); + } catch (Exception $e) { + return null; + } + if ($decrypted === false) { return null; } |