From 4e5ca26342dc731f7510174102151af8878ca47a Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 10 Jun 2015 07:10:03 -0500 Subject: [PATCH] RC4: re-add the OpenSSL changes for RC4 looks like they got skipped over when the merge conflict was resolved --- phpseclib/Crypt/RC4.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/phpseclib/Crypt/RC4.php b/phpseclib/Crypt/RC4.php index d85afa4d..2c7f74c2 100644 --- a/phpseclib/Crypt/RC4.php +++ b/phpseclib/Crypt/RC4.php @@ -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. *