Ejemplo n.º 1
0
 /**
  * Test for engine validity
  *
  * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()
  *
  * @see \phpseclib\Crypt\Base::isValidEngine()
  * @param int $engine
  * @access public
  * @return bool
  */
 function isValidEngine($engine)
 {
     if ($engine == self::ENGINE_OPENSSL) {
         if ($this->key_length != 16) {
             return false;
         }
         $this->cipher_name_openssl_ecb = 'bf-ecb';
         $this->cipher_name_openssl = 'bf-' . $this->_openssl_translate_mode();
     }
     return parent::isValidEngine($engine);
 }
Ejemplo n.º 2
0
 /**
  * Test for engine validity
  *
  * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()
  *
  * @see \phpseclib\Crypt\Base::__construct()
  * @param int $engine
  * @access public
  * @return bool
  */
 function isValidEngine($engine)
 {
     switch ($engine) {
         case self::ENGINE_OPENSSL:
             if ($this->current_key_length != 128 || strlen($this->orig_key) < 16) {
                 return false;
             }
             $this->cipher_name_openssl_ecb = 'rc2-ecb';
             $this->cipher_name_openssl = 'rc2-' . $this->_openssl_translate_mode();
     }
     return parent::isValidEngine($engine);
 }
Ejemplo n.º 3
0
 /**
  * Test for engine validity
  *
  * This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()
  *
  * @see \phpseclib\Crypt\Base::Crypt_Base()
  * @param Integer $engine
  * @access public
  * @return Boolean
  */
 function isValidEngine($engine)
 {
     switch ($engine) {
         case self::ENGINE_OPENSSL:
             if ($this->block_size != 16) {
                 return false;
             }
             $this->cipher_name_openssl_ecb = 'aes-' . ($this->key_size << 3) . '-ecb';
             $this->cipher_name_openssl = 'aes-' . ($this->key_size << 3) . '-' . $this->_openssl_translate_mode();
             break;
         case self::ENGINE_MCRYPT:
             $this->cipher_name_mcrypt = 'rijndael-' . ($this->block_size << 3);
             if ($this->key_size % 8) {
                 // is it a 160/224-bit key?
                 // mcrypt is not usable for them, only for 128/192/256-bit keys
                 return false;
             }
     }
     return parent::isValidEngine($engine);
 }
Ejemplo n.º 4
0
 /**
  * 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);
 }
Ejemplo n.º 5
0
 /**
  * Test for engine validity
  *
  * This is mainly just a wrapper to set things up for Crypt_Base::isValidEngine()
  *
  * @see \phpseclib\Crypt\Base::isValidEngine()
  * @param int $engine
  * @access public
  * @return bool
  */
 function isValidEngine($engine)
 {
     if ($this->key_size_max == 8) {
         if ($engine == self::ENGINE_OPENSSL) {
             $this->cipher_name_openssl_ecb = 'des-ecb';
             $this->cipher_name_openssl = 'des-' . $this->_openssl_translate_mode();
         }
     }
     return parent::isValidEngine($engine);
 }