mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 10:15:14 +00:00
- if the algorithm is not supported upon mcrypt's initial initialization use the internal implementation
git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@220 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
parent
5a4595ab56
commit
b39d2597dd
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user