Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Pass correct mode string to phpseclib #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

suneth-perera
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant