Skip to content

Commit

Permalink
Merge branch '2.0' into 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Nov 22, 2023
2 parents 7b893c5 + f1e5854 commit be05f4e
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions phpseclib/Net/SSH2.php
Expand Up @@ -343,14 +343,6 @@ class SSH2
*/
private $languages_client_to_server = false;

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

/**
* Preferred Algorithms
*
Expand Down Expand Up @@ -2350,7 +2342,7 @@ private function login_helper($username, $password = null)
for ($i = 0; $i < $nr_extensions; $i++) {
list($extension_name, $extension_value) = Strings::unpackSSH2('ss', $response);
if ($extension_name == 'server-sig-algs') {
$this->server_sig_algs = explode(',', $extension_value);
$this->supported_private_key_algorithms = explode(',', $extension_value);
}
}

Expand Down Expand Up @@ -2634,9 +2626,7 @@ private function privatekey_login($username, PrivateKey $privatekey)
if ($publickey instanceof RSA) {
$privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1);
$algos = ['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 = self::array_intersect_first($algos, $this->supported_private_key_algorithms);
Expand Down

0 comments on commit be05f4e

Please sign in to comment.