Skip to content

Commit

Permalink
SSH2: another attempt at #1960
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Nov 22, 2023
1 parent 49c9439 commit e84886f
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions phpseclib/Net/SSH2.php
Expand Up @@ -360,15 +360,6 @@ class Net_SSH2
*/
var $languages_client_to_server = false;

/**
* Server Signature Algorithms
*
* @link https://www.rfc-editor.org/rfc/rfc8308.html#section-3.1
* @var array|false
* @access private
*/
var $server_sig_algs = false;

/**
* Preferred Algorithms
*
Expand Down Expand Up @@ -2446,7 +2437,7 @@ function _login_helper($username, $password = null)
return false;
}
$temp = unpack('Nlength', $this->_string_shift($response, 4));
$this->server_sig_algs = explode(',', $this->_string_shift($response, $temp['length']));
$this->supported_private_key_algorithms = explode(',', $this->_string_shift($response, $temp['length']));
}
}

Expand Down Expand Up @@ -2829,9 +2820,7 @@ function _privatekey_login($username, $privatekey)
);

$algos = array('rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa');
if ($this->server_sig_algs) {
$algos = array_intersect($algos, $this->server_sig_algs);
} elseif (isset($this->preferred['hostkey'])) {
if (isset($this->preferred['hostkey'])) {
$algos = array_intersect($algos, $this->preferred['hostkey']);
}
$algo = $this->_array_intersect_first($algos, $this->supported_private_key_algorithms);
Expand Down

0 comments on commit e84886f

Please sign in to comment.