From 5bcb298af75efdad21496ec9638afd462f1c0329 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 2 Dec 2018 12:01:56 -0600 Subject: [PATCH] SymmetricKey: throw an exception when en/de-crypting w/o a key --- phpseclib/Crypt/Common/SymmetricKey.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpseclib/Crypt/Common/SymmetricKey.php b/phpseclib/Crypt/Common/SymmetricKey.php index a387a57a..504af61a 100644 --- a/phpseclib/Crypt/Common/SymmetricKey.php +++ b/phpseclib/Crypt/Common/SymmetricKey.php @@ -2133,6 +2133,10 @@ abstract class SymmetricKey throw new \UnexpectedValueException('No IV has been defined'); } + if ($this->key === false) { + throw new \UnexpectedValueException('No key has been defined'); + } + $this->encryptIV = $this->decryptIV = $this->iv; }