Skip to content
Snippets Groups Projects
Commit eff61b3e authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

The ciphertext should never be less than 48 bytes, throw an exception in such case.

parent 150c1ef1
No related branches found
No related tags found
No related merge requests found
......@@ -24,8 +24,10 @@ class Crypto
*/
private static function _aesDecrypt($ciphertext, $secret)
{
if (!is_string($ciphertext)) {
throw new \InvalidArgumentException('Input parameter "$ciphertext" must be a string.');
if (!is_string($ciphertext) || mb_strlen($ciphertext, '8bit') < 48) {
throw new \InvalidArgumentException(
'Input parameter "$ciphertext" must be a string with more than 48 characters.'
);
}
if (!function_exists("openssl_decrypt")) {
throw new \SimpleSAML_Error_Exception("The openssl PHP module is not loaded.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment