diff --git a/phpseclib/Crypt/AES.php b/phpseclib/Crypt/AES.php index 07e975b8..94a08423 100644 --- a/phpseclib/Crypt/AES.php +++ b/phpseclib/Crypt/AES.php @@ -178,10 +178,7 @@ class Crypt_AES extends Crypt_Rijndael { { if ( !defined('CRYPT_AES_MODE') ) { switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if aes was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... + case extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()): define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT); break; default: diff --git a/phpseclib/Crypt/DES.php b/phpseclib/Crypt/DES.php index b8322507..c249d6b6 100644 --- a/phpseclib/Crypt/DES.php +++ b/phpseclib/Crypt/DES.php @@ -295,10 +295,7 @@ class Crypt_DES { { if ( !defined('CRYPT_DES_MODE') ) { switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... + case extension_loaded('mcrypt') && in_array('des', mcrypt_list_algorithms()): define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); break; default: diff --git a/phpseclib/Crypt/RC4.php b/phpseclib/Crypt/RC4.php index 0826362d..0eb1c2b5 100644 --- a/phpseclib/Crypt/RC4.php +++ b/phpseclib/Crypt/RC4.php @@ -142,15 +142,6 @@ class Crypt_RC4 { */ var $decryptIndex = 0; - /** - * MCrypt parameters - * - * @see Crypt_RC4::setMCrypt() - * @var Array - * @access private - */ - var $mcrypt = array('', ''); - /** * The Encryption Algorithm * @@ -184,10 +175,7 @@ class Crypt_RC4 { { if ( !defined('CRYPT_RC4_MODE') ) { switch (true) { - case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')): - // i'd check to see if rc4 was supported, by doing in_array('arcfour', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... + case extension_loaded('mcrypt') && (defined('MCRYPT_ARCFOUR') || defined('MCRYPT_RC4')) && in_array('arcfour', mcrypt_list_algorithms()): define('CRYPT_RC4_MODE', CRYPT_RC4_MODE_MCRYPT); break; default: @@ -323,24 +311,6 @@ class Crypt_RC4 { { } - /** - * Sets MCrypt parameters. (optional) - * - * If MCrypt is being used, empty strings will be used, unless otherwise specified. - * - * @link http://php.net/function.mcrypt-module-open#function.mcrypt-module-open - * @access public - * @param optional Integer $algorithm_directory - * @param optional Integer $mode_directory - */ - function setMCrypt($algorithm_directory = '', $mode_directory = '') - { - if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { - $this->mcrypt = array($algorithm_directory, $mode_directory); - $this->_closeMCrypt(); - } - } - /** * Encrypts a message. * diff --git a/phpseclib/Crypt/TripleDES.php b/phpseclib/Crypt/TripleDES.php index adb2a309..9f4757ec 100644 --- a/phpseclib/Crypt/TripleDES.php +++ b/phpseclib/Crypt/TripleDES.php @@ -248,10 +248,7 @@ class Crypt_TripleDES { { if ( !defined('CRYPT_DES_MODE') ) { switch (true) { - case extension_loaded('mcrypt'): - // i'd check to see if des was supported, by doing in_array('des', mcrypt_list_algorithms('')), - // but since that can be changed after the object has been created, there doesn't seem to be - // a lot of point... + case extension_loaded('mcrypt') && in_array('tripledes', mcrypt_list_algorithms()): define('CRYPT_DES_MODE', CRYPT_DES_MODE_MCRYPT); break; default: