@electerm/ssh2 1.11.1 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -616,7 +616,15 @@ class Protocol {
616
616
  if (pubKey instanceof Error)
617
617
  throw new Error('Invalid key');
618
618
 
619
- const keyType = pubKey.type;
619
+ let keyType = pubKey.type;
620
+ if (keyType === 'ssh-rsa') {
621
+ for (const algo of ['rsa-sha2-512', 'rsa-sha2-256']) {
622
+ if (this._remoteHostKeyAlgorithms.includes(algo)) {
623
+ keyType = algo;
624
+ break;
625
+ }
626
+ }
627
+ }
620
628
  pubKey = pubKey.getPublicSSH();
621
629
 
622
630
  const userLen = Buffer.byteLength(username);
@@ -196,7 +196,7 @@ function handleKexInit(self, payload) {
196
196
 
197
197
  const local = self._offer;
198
198
  const remote = init;
199
-
199
+ self._remoteHostKeyAlgorithms = remote.serverHostKey;
200
200
  let localKex = local.lists.kex.array;
201
201
  if (self._compatFlags & COMPAT.BAD_DHGEX) {
202
202
  let found = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/ssh2",
3
- "version": "1.11.1",
3
+ "version": "1.11.2",
4
4
  "author": "Brian White <mscdex@mscdex.net>",
5
5
  "description": "SSH2 client and server modules written in pure JavaScript for node.js",
6
6
  "main": "./lib/index.js",