mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
Merge branch '3.0'
This commit is contained in:
commit
c6f25ccde3
@ -330,14 +330,6 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
private array|false $languages_client_to_server = false;
|
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
|
* Preferred Algorithms
|
||||||
*
|
*
|
||||||
@ -2070,7 +2062,7 @@ class SSH2
|
|||||||
for ($i = 0; $i < $nr_extensions; $i++) {
|
for ($i = 0; $i < $nr_extensions; $i++) {
|
||||||
[$extension_name, $extension_value] = Strings::unpackSSH2('ss', $response);
|
[$extension_name, $extension_value] = Strings::unpackSSH2('ss', $response);
|
||||||
if ($extension_name == 'server-sig-algs') {
|
if ($extension_name == 'server-sig-algs') {
|
||||||
$this->server_sig_algs = explode(',', $extension_value);
|
$this->supported_private_key_algorithms = explode(',', $extension_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2342,9 +2334,7 @@ class SSH2
|
|||||||
if ($publickey instanceof RSA) {
|
if ($publickey instanceof RSA) {
|
||||||
$privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1);
|
$privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1);
|
||||||
$algos = ['rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa'];
|
$algos = ['rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa'];
|
||||||
if ($this->server_sig_algs) {
|
if (isset($this->preferred['hostkey'])) {
|
||||||
$algos = array_intersect($algos, $this->server_sig_algs);
|
|
||||||
} elseif (isset($this->preferred['hostkey'])) {
|
|
||||||
$algos = array_intersect($algos, $this->preferred['hostkey']);
|
$algos = array_intersect($algos, $this->preferred['hostkey']);
|
||||||
}
|
}
|
||||||
$algo = self::array_intersect_first($algos, $this->supported_private_key_algorithms);
|
$algo = self::array_intersect_first($algos, $this->supported_private_key_algorithms);
|
||||||
|
Loading…
Reference in New Issue
Block a user