diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index cc134d63..1bcffe4d 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -49,6 +49,7 @@ class Random * eg. for RSA key generation. * * @param Integer $length + * @throws \RuntimeException if a symmetric cipher is needed but not loaded * @return String */ public static function string($length) @@ -199,8 +200,7 @@ class Random $crypto = new RC4(); break; default: - user_error(__CLASS__ . ' requires at least one symmetric cipher be loaded'); - return false; + throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded'); } $crypto->setKey($key);