From abed3b4c28a86704483a604bdba4565237268960 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 14 Feb 2016 11:33:43 -0600 Subject: [PATCH] AES/Twofish: updates based on feedback --- phpseclib/Crypt/AES.php | 3 ++- phpseclib/Crypt/Twofish.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/AES.php b/phpseclib/Crypt/AES.php index 87bae702..7ad292b1 100644 --- a/phpseclib/Crypt/AES.php +++ b/phpseclib/Crypt/AES.php @@ -67,6 +67,7 @@ class AES extends Rijndael * * @see \phpseclib\Crypt\Rijndael::setBlockLength() * @access public + * @param int $length * @throws \BadMethodCallException anytime it's called */ function setBlockLength($length) @@ -92,7 +93,7 @@ class AES extends Rijndael case 256: break; default: - throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); + throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 128, 192 or 256 supported'); } parent::setKeyLength($length); } diff --git a/phpseclib/Crypt/Twofish.php b/phpseclib/Crypt/Twofish.php index 4aad1a4d..ba2cd6db 100644 --- a/phpseclib/Crypt/Twofish.php +++ b/phpseclib/Crypt/Twofish.php @@ -402,7 +402,7 @@ class Twofish extends Base case 256: break; default: - throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported'); + throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 128, 192 or 256 supported'); } parent::setKeyLength($length);