mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-05 21:17:53 +00:00
Merge pull request #704 from terrafrost/openssl-rc4
RC4: re-add the OpenSSL changes for RC4 * terrafrost/openssl-rc4: RC4: re-add the OpenSSL changes for RC4
This commit is contained in:
commit
76c5cedbf9
@ -135,6 +135,38 @@ class RC4 extends Base
|
||||
parent::__construct(Base::MODE_STREAM);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for engine validity
|
||||
*
|
||||
* This is mainly just a wrapper to set things up for Crypt_Base::isValidEngine()
|
||||
*
|
||||
* @see Crypt_Base::Crypt_Base()
|
||||
* @param Integer $engine
|
||||
* @access public
|
||||
* @return Boolean
|
||||
*/
|
||||
function isValidEngine($engine)
|
||||
{
|
||||
switch ($engine) {
|
||||
case Base::ENGINE_OPENSSL:
|
||||
switch (strlen($this->key)) {
|
||||
case 5:
|
||||
$this->cipher_name_openssl = 'rc4-40';
|
||||
break;
|
||||
case 8:
|
||||
$this->cipher_name_openssl = 'rc4-64';
|
||||
break;
|
||||
case 16:
|
||||
$this->cipher_name_openssl = 'rc4';
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parent::isValidEngine($engine);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dummy function.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user