Ejemplo n.º 1
0
 /**
  * Decrypts a message.
  *
  * Mostly a wrapper for \phpseclib\Crypt\Base::decrypt, with some additional OpenSSL handling code
  *
  * @see self::encrypt()
  * @access public
  * @param string $ciphertext
  * @return string $plaintext
  */
 function decrypt($ciphertext)
 {
     if ($this->engine == self::ENGINE_OPENSSL) {
         $temp = $this->key;
         $this->key = $this->orig_key;
         $result = parent::decrypt($ciphertext);
         $this->key = $temp;
         return $result;
     }
     return parent::encrypt($ciphertext);
 }
Ejemplo n.º 2
0
 /**
  * Encrypts a message.
  *
  * @see \phpseclib\Crypt\Base::decrypt()
  * @see \phpseclib\Crypt\RC4::_crypt()
  * @access public
  * @param String $plaintext
  * @return String $ciphertext
  */
 function encrypt($plaintext)
 {
     if ($this->engine != Base::ENGINE_INTERNAL) {
         return parent::encrypt($plaintext);
     }
     return $this->_crypt($plaintext, self::ENCRYPT);
 }