jose-php icon indicating copy to clipboard operation
jose-php copied to clipboard

Pass correct mode string to phpseclib

Open suneth-perera opened this issue 2 years ago • 0 comments

  • 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'); }

suneth-perera avatar Oct 30 '23 23:10 suneth-perera