steelbrain / steelbrain/node-ssh

Can't connect to SFTP server: Error: Cannot parse privateKey: decrypted is not defined

Open
#368 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1k
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I am trying to connect to SFTP server using Node.js v12.19.0 and i am always getting this:

Error: Cannot parse privateKey: decrypted is not defined.

I searched for this error on the web, but i didnt found anything about it.
Here is my code:

const { NodeSSH } = require('node-ssh');
const ssh = new NodeSSH(); 
ssh.connect({
    host: 'test.domain.com',
    port: 422,
    username: 'lorem',
    privateKey: './private.ppk',
    passphrase: 'phrase'
}).then(function() {
    console.log("Conected");
}).catch(function (err) {
    console.log("Can NOT connect: " + err);
});

Also, I am including a modificated copy of my private key (in case it helps), which i created with PuTTy.

PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20210205
Public-Lines: 6
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
vzlN5qsnU1AZa1NLrwLrYEH/V01eHhUExyHQIkPf2E61g7WsOM4UY5/gT2hnRcbY
tXeXCTGpK2cfPQ6491Y+ujhO6d0gdvXMX1MTWrGohlGTnBDJoHDeC7zlRg6Xm0DN
UzA8dshPm7PvF6Y4uJWxoZUjJlDnjsNIxJ5X/gMIiWkNbq6gdw==
Private-Lines: 14
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Li3nvG6a+IQa03YYGhstPvJEhsGshhrRFkIoL7i9guDWBPyr0lDeGOaH9V8XRxNB
WZaPC0/ScuF6a3R0zw7eugLIvXeg9hqK8kuhz85vIdEoTXDKTAFwaIX9DLgZ3ub7
Czk8fgBBzRTrrxEjzYAijRIDvFoag1csYZ+2o3TbN1h4GqtkTGGDONqd9/dKBC13
SD4RAVHodA6Is4emE7MVWnoI9sBT+oXPz4Ca5QR5ItKjj5bYVzNLV3JI3Wi4iaWf
Ib7SkpVOzrrInHwEv/y9hlJAzUH+APdy0IYuGEg16qcUgMy+DySW84wir5aB1emT
ENuSSomsG4HoqY7D5AoJ9UOmU8ochbtu+QyPUOUSO2Lamr02AZOkGFtJqUyez/Cd
2Sz4vU62iviojLKzmvmo9Ql4/wgCateAaMbmGFF9KAaCSJeYIeyyV4pkzfG6JEQ8
KIrjUBAoWivicLKd+rjn8A0or2t7JWDwL53BjjHctwGmPImAbbOQRePMeSwyApXX
G6Xc2EiRAsQW4RjIyuEIH3h5DlCmKYa5/Q8GbxCQYbbfobofc6Ohd2Cqs+v2+3di
rcEozhjr3bIR9alTZHHEuBa7qRv8oyMX77IT+tmja6SzRBVOaGpYiI7QgZg7Nxl9
Private-MAC: 111111111111111111111111111111

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the ssh.connect call with Node.js v12.19.0, the supplied PuTTY private-key format, and its passphrase. No repository file or test is identified in the report; done means determining whether that key input is supported and documenting or correcting the resulting privateKey parsing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.