Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Nov 22, 2023
2 parents d88db1a + be05f4e commit c6f25cc
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions phpseclib/Net/SSH2.php
Expand Up @@ -330,14 +330,6 @@ class SSH2
*/
private array|false $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 @@ -2070,7 +2062,7 @@ private function login_helper(string $username, $password = null): bool
for ($i = 0; $i < $nr_extensions; $i++) {
[$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 @@ -2342,9 +2334,7 @@ private function privatekey_login(string $username, PrivateKey $privatekey): boo
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 c6f25cc

Please sign in to comment.