jose-php
jose-php copied to clipboard
Pass correct mode string to phpseclib
- In the current process in cipher() method in JWE.php its
$cipher = new AES(AES::MODE_CBC);where AES::MODE_CBC will be '2'. - and according to the SymmetricKey.php constructor code shown below expects $mode to be a string. As the current code is passing 2, it endsup throw new BadModeException('No valid mode has been specified');
$mode = strtolower($mode); // necessary because of 5.6 compatibility; we can't do isset(self::MODE_MAP[$mode]) in 5.6 $map = self::MODE_MAP; if (!isset($map[$mode])) { throw new BadModeException('No valid mode has been specified'); }