mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-06 13:58:33 +00:00
Merge remote-tracking branch 'rrran/Bugfixes'
This commit is contained in:
commit
610d3d6ea0
@ -45,7 +45,6 @@ abstract class Objects
|
|||||||
* @param Object $obj
|
* @param Object $obj
|
||||||
* @param string $var
|
* @param string $var
|
||||||
* @param mixed $val
|
* @param mixed $val
|
||||||
* @return mixed
|
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public static function setVar($obj, $var, $val)
|
public static function setVar($obj, $var, $val)
|
||||||
@ -53,7 +52,7 @@ abstract class Objects
|
|||||||
$reflection = new \ReflectionClass(get_class($obj));
|
$reflection = new \ReflectionClass(get_class($obj));
|
||||||
$prop = $reflection->getProperty($var);
|
$prop = $reflection->getProperty($var);
|
||||||
$prop->setAccessible(true);
|
$prop->setAccessible(true);
|
||||||
return $prop->setValue($obj, $val);
|
$prop->setValue($obj, $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
namespace phpseclib\Crypt\Common\Signature;
|
namespace phpseclib\Crypt\Common\Signature;
|
||||||
|
|
||||||
use phpseclib\Math\BigInteger;
|
use phpseclib\Math\BigInteger;
|
||||||
use phpseclib\Common\Functions\Strings;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raw Signature Handler
|
* Raw Signature Handler
|
||||||
@ -33,7 +32,7 @@ abstract class Raw
|
|||||||
* Loads a signature
|
* Loads a signature
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $key
|
* @param array $sig
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function load($sig)
|
public static function load($sig)
|
||||||
@ -47,8 +46,8 @@ abstract class Raw
|
|||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'r' => $key['r'],
|
'r' => $sig['r'],
|
||||||
's' => $key['s']
|
's' => $sig['s']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,8 @@ abstract class SSH2
|
|||||||
* Loads a signature
|
* Loads a signature
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param array $key
|
* @param array $sig
|
||||||
* @return array
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function load($sig)
|
public static function load($sig)
|
||||||
{
|
{
|
||||||
@ -67,9 +67,9 @@ abstract class SSH2
|
|||||||
*/
|
*/
|
||||||
public static function save(BigInteger $r, BigInteger $s)
|
public static function save(BigInteger $r, BigInteger $s)
|
||||||
{
|
{
|
||||||
if ($r->getLength() != 160 || $s->getLength != 160) {
|
if ($r->getLength() != 160 || $s->getLength() != 160) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Strings::pack('ss', $r, $s);
|
return Strings::packSSH2('ss', $r, $s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -201,6 +201,15 @@ class RSA extends AsymmetricKey
|
|||||||
*/
|
*/
|
||||||
private $sLen;
|
private $sLen;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comment
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
private $comment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash function for the Mask Generation Function
|
* Hash function for the Mask Generation Function
|
||||||
*
|
*
|
||||||
|
@ -258,6 +258,7 @@ class TripleDES extends DES
|
|||||||
switch (strlen($key)) {
|
switch (strlen($key)) {
|
||||||
case 16:
|
case 16:
|
||||||
$key.= substr($key, 0, 8);
|
$key.= substr($key, 0, 8);
|
||||||
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -438,7 +439,6 @@ class TripleDES extends DES
|
|||||||
* @see \phpseclib\Crypt\Common\SymmetricKey::setPreferredEngine()
|
* @see \phpseclib\Crypt\Common\SymmetricKey::setPreferredEngine()
|
||||||
* @param int $engine
|
* @param int $engine
|
||||||
* @access public
|
* @access public
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function setPreferredEngine($engine)
|
public function setPreferredEngine($engine)
|
||||||
{
|
{
|
||||||
@ -448,6 +448,6 @@ class TripleDES extends DES
|
|||||||
$this->des[2]->setPreferredEngine($engine);
|
$this->des[2]->setPreferredEngine($engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::setPreferredEngine($engine);
|
parent::setPreferredEngine($engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ class Twofish extends BlockCipher
|
|||||||
case 256:
|
case 256:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported');
|
throw new \LengthException('Key of size ' . $length . ' not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::setKeyLength($length);
|
parent::setKeyLength($length);
|
||||||
|
@ -547,7 +547,7 @@ class SSH1
|
|||||||
{
|
{
|
||||||
$this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->connectionTimeout);
|
$this->fsock = @fsockopen($this->host, $this->port, $errno, $errstr, $this->connectionTimeout);
|
||||||
if (!$this->fsock) {
|
if (!$this->fsock) {
|
||||||
throw new \RuntimeException(rtrim("Cannot connect to $host. Error $errno. $errstr"));
|
throw new \RuntimeException(rtrim("Cannot connect to $this->host. Error $errno. $errstr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->server_identification = $init_line = fgets($this->fsock, 255);
|
$this->server_identification = $init_line = fgets($this->fsock, 255);
|
||||||
@ -924,7 +924,7 @@ class SSH1
|
|||||||
* @throws \RuntimeException on connection error
|
* @throws \RuntimeException on connection error
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function read($expect, $mode = self::READ__SIMPLE)
|
public function read($expect, $mode = self::READ_SIMPLE)
|
||||||
{
|
{
|
||||||
if (!($this->bitmap & self::MASK_LOGIN)) {
|
if (!($this->bitmap & self::MASK_LOGIN)) {
|
||||||
throw new \RuntimeException('Operation disallowed prior to login()');
|
throw new \RuntimeException('Operation disallowed prior to login()');
|
||||||
@ -936,7 +936,7 @@ class SSH1
|
|||||||
|
|
||||||
$match = $expect;
|
$match = $expect;
|
||||||
while (true) {
|
while (true) {
|
||||||
if ($mode == self::READ__REGEX) {
|
if ($mode == self::READ_REGEX) {
|
||||||
preg_match($expect, $this->interactiveBuffer, $matches);
|
preg_match($expect, $this->interactiveBuffer, $matches);
|
||||||
$match = isset($matches[0]) ? $matches[0] : '';
|
$match = isset($matches[0]) ? $matches[0] : '';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user