@electerm/ssh2 1.11.0 → 1.11.1

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.
Files changed (2) hide show
  1. package/lib/client.js +11 -1
  2. package/package.json +3 -2
package/lib/client.js CHANGED
@@ -402,7 +402,17 @@ class Client extends EventEmitter {
402
402
  });
403
403
  } else if (curAuth.type === 'publickey') {
404
404
  proto.authPK(curAuth.username, curAuth.key, (buf, cb) => {
405
- const signature = curAuth.key.sign(buf);
405
+ let signatureAlgo;
406
+ if (curAuth.key.type === 'ssh-rsa') {
407
+ if (this._protocol._remoteHostKeyAlgorithms
408
+ .includes('rsa-sha2-512')) {
409
+ signatureAlgo = 'sha512';
410
+ } else if (this._protocol._remoteHostKeyAlgorithms
411
+ .includes('rsa-sha2-256')) {
412
+ signatureAlgo = 'sha256';
413
+ }
414
+ }
415
+ const signature = curAuth.key.sign(buf, signatureAlgo);
406
416
  if (signature instanceof Error) {
407
417
  signature.message =
408
418
  `Error signing data with key: ${signature.message}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/ssh2",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
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",
@@ -13,7 +13,8 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@mscdex/eslint-config": "^1.1.0",
16
- "eslint": "^7.0.0"
16
+ "eslint": "^7.0.0",
17
+ "nan": "^2.16.0"
17
18
  },
18
19
  "scripts": {
19
20
  "install": "node install.js",