mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-15 01:44:06 +00:00
Merge branch '2.0-crypt-fix-old-openssl'
This commit is contained in:
commit
085d5ed495
@ -333,6 +333,9 @@ class Blowfish extends BlockCipher
|
|||||||
public function isValidEngine($engine)
|
public function isValidEngine($engine)
|
||||||
{
|
{
|
||||||
if ($engine == self::ENGINE_OPENSSL) {
|
if ($engine == self::ENGINE_OPENSSL) {
|
||||||
|
if (version_compare(PHP_VERSION, '5.3.7') < 0 && $this->key_length != 16) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if ($this->key_length < 16) {
|
if ($this->key_length < 16) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,23 @@ class RC4 extends StreamCipher
|
|||||||
public function isValidEngine($engine)
|
public function isValidEngine($engine)
|
||||||
{
|
{
|
||||||
if ($engine == self::ENGINE_OPENSSL) {
|
if ($engine == self::ENGINE_OPENSSL) {
|
||||||
$this->cipher_name_openssl = 'rc4-40';
|
if (version_compare(PHP_VERSION, '5.3.7') >= 0) {
|
||||||
|
$this->cipher_name_openssl = 'rc4-40';
|
||||||
|
} else {
|
||||||
|
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);
|
return parent::isValidEngine($engine);
|
||||||
|
Loading…
Reference in New Issue
Block a user