diff --git a/phpseclib/Crypt/Blowfish.php b/phpseclib/Crypt/Blowfish.php index 825efcfc..417d5d28 100644 --- a/phpseclib/Crypt/Blowfish.php +++ b/phpseclib/Crypt/Blowfish.php @@ -339,7 +339,7 @@ class Blowfish extends BlockCipher if ($this->key_length < 16) { return false; } - self::$cipher_name_openssl_ecb = 'bf-ecb'; + $this->cipher_name_openssl_ecb = 'bf-ecb'; $this->cipher_name_openssl = 'bf-' . $this->openssl_translate_mode(); } diff --git a/phpseclib/Crypt/Common/SymmetricKey.php b/phpseclib/Crypt/Common/SymmetricKey.php index 605458e0..dacd25f8 100644 --- a/phpseclib/Crypt/Common/SymmetricKey.php +++ b/phpseclib/Crypt/Common/SymmetricKey.php @@ -475,7 +475,7 @@ abstract class SymmetricKey * @var string * @access private */ - protected static $cipher_name_openssl_ecb; + protected $cipher_name_openssl_ecb; /** * The default salt used by setPassword() @@ -1915,7 +1915,7 @@ abstract class SymmetricKey for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); if (strlen($block) > strlen($buffer['ciphertext'])) { - $buffer['ciphertext'].= openssl_encrypt($xor, static::$cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); + $buffer['ciphertext'].= openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); } Strings::increment_str($xor); $otp = Strings::shift($buffer['ciphertext'], $block_size); @@ -1924,7 +1924,7 @@ abstract class SymmetricKey } else { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); - $otp = openssl_encrypt($xor, static::$cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); + $otp = openssl_encrypt($xor, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); Strings::increment_str($xor); $ciphertext.= $block ^ $otp; } @@ -1966,7 +1966,7 @@ abstract class SymmetricKey } } if ($this->continuousBuffer) { - $encryptIV = openssl_decrypt($encryptIV, static::$cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); + $encryptIV = openssl_decrypt($encryptIV, $this->cipher_name_openssl_ecb, $key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING); if ($overflow) { Strings::increment_str($encryptIV); } @@ -2191,7 +2191,7 @@ abstract class SymmetricKey // that don't we'll emulate it switch ($this->mode) { case self::MODE_CTR: - if (in_array(static::$cipher_name_openssl_ecb, $methods)) { + if (in_array($this->cipher_name_openssl_ecb, $methods)) { $this->openssl_emulate_ctr = true; return true; } diff --git a/phpseclib/Crypt/DES.php b/phpseclib/Crypt/DES.php index ed6fb62e..8a277973 100644 --- a/phpseclib/Crypt/DES.php +++ b/phpseclib/Crypt/DES.php @@ -613,7 +613,7 @@ class DES extends BlockCipher { if ($this->key_length_max == 8) { if ($engine == self::ENGINE_OPENSSL) { - self::$cipher_name_openssl_ecb = 'des-ecb'; + $this->cipher_name_openssl_ecb = 'des-ecb'; $this->cipher_name_openssl = 'des-' . $this->openssl_translate_mode(); } } diff --git a/phpseclib/Crypt/RC2.php b/phpseclib/Crypt/RC2.php index 3f337d97..210337a4 100644 --- a/phpseclib/Crypt/RC2.php +++ b/phpseclib/Crypt/RC2.php @@ -298,7 +298,7 @@ class RC2 extends BlockCipher if ($this->current_key_length != 128 || strlen($this->orig_key) < 16) { return false; } - self::$cipher_name_openssl_ecb = 'rc2-ecb'; + $this->cipher_name_openssl_ecb = 'rc2-ecb'; $this->cipher_name_openssl = 'rc2-' . $this->openssl_translate_mode(); } diff --git a/phpseclib/Crypt/Rijndael.php b/phpseclib/Crypt/Rijndael.php index c0b37092..8aafc7a6 100644 --- a/phpseclib/Crypt/Rijndael.php +++ b/phpseclib/Crypt/Rijndael.php @@ -308,7 +308,7 @@ class Rijndael extends BlockCipher if ($this->block_size != 16) { return false; } - self::$cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb'; + $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_length << 3) . '-ecb'; $this->cipher_name_openssl = 'aes-' . ($this->key_length << 3) . '-' . $this->openssl_translate_mode(); break; case self::ENGINE_MCRYPT: diff --git a/phpseclib/Crypt/TripleDES.php b/phpseclib/Crypt/TripleDES.php index 6e640392..3c57d52b 100644 --- a/phpseclib/Crypt/TripleDES.php +++ b/phpseclib/Crypt/TripleDES.php @@ -187,7 +187,7 @@ class TripleDES extends DES protected function isValidEngineHelper($engine) { if ($engine == self::ENGINE_OPENSSL) { - self::$cipher_name_openssl_ecb = 'des-ede3'; + $this->cipher_name_openssl_ecb = 'des-ede3'; $mode = $this->openssl_translate_mode(); $this->cipher_name_openssl = $mode == 'ecb' ? 'des-ede3' : 'des-ede3-' . $mode; }