Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect fails, using valid/current OpenSSH key: "Uncaught Error: Cannot parse privateKey: Unsupported key format", #143

Closed
ghost opened this issue Jul 9, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented Jul 9, 2015

I've installed

    atom v1.0.0
    Remote-FTP, v0.7.1

on linux64.

I setup an '.ftpconfig'

    {
        "protocol": "sftp",
        "host": "test.DDDD.com",
        "port": 22,
        "user": "root",
        "remote": "/",
        "agent": "",
        "privatekey": "/etc/ssh/pgnd-dev03.ed25519.key",
        "passphrase": "",
        "hosthash": "",
        "ignorehost": true,
        "connTimeout": 10000,
        "keepalive": 10000,
        "keyboardInteractive": false
    }

where privatekey is a valid & regularly used openSSH-generated ed25519 key. It's current being used to connect via openSSH (openSSH_6.9p1, OpenSSL 1.0.2c 12 Jun 2015), from shell, to the 'test.DDDD.com' host.

On attempt to make the connection in atom, the following error's thrown

    **Atom Version**: 1.0.0-3874576
    **System**: "openSUSE 13.2
    **Thrown From**: [Remote-FTP](https://github.com/mgrenier/remote-ftp) package, v0.7.1


    ### Stack Trace

    Uncaught Error: Cannot parse privateKey: Unsupported key format

    ```
    At /home/pgnd/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:147

    Error: Cannot parse privateKey: Unsupported key format
      at Client.connect (/home/pgnd/.atom/packages/Remote-FTP/node_modules/ssh2/lib/client.js:147:13)
      at ConnectorSFTP.module.exports.ConnectorSFTP.connect (/home/pgnd/.atom/packages/Remote-FTP/lib/connectors/sftp.js:78:13)
      at Client.module.exports.Client.connect (/home/pgnd/.atom/packages/Remote-FTP/lib/client.js:198:18)
      at Client.<anonymous> (/home/pgnd/.atom/packages/Remote-FTP/lib/views/tree-view.js:178:28)
      at /home/pgnd/.atom/packages/Remote-FTP/lib/client.js:87:14
      at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:379:3)
@mscdex
Copy link

mscdex commented Jul 9, 2015

ssh2 currently does not support ed25519 keys because node.js/io.js currently only supports RSA and DSA keys for the purposes of its crypto API (especially signing and verifying). There are of course pure-js EC libraries on npm, but I greatly prefer to stick to OpenSSL if for no other reason than speed.

@ghost
Copy link
Author

ghost commented Jul 9, 2015

@mscdex Hi, thx for the reply here!

Sticking with OpenSSL is a good -- or at least practical -- thing, imo.

So sounds like this needs to be taken up with/at node.js? If it were to get 'fixed' there, iiuc, the fix would percolate through your ssh2 to here, @ the remote-ftp pkg?

@mscdex
Copy link

mscdex commented Jul 9, 2015

@pgnd Yes. Although you have to keep in mind that if/when the changes make it into a node/io.js release, you'd have to upgrade to that version (that may/may not be a problem for you).

@ghost
Copy link
Author

ghost commented Jul 9, 2015

@mscdex Great. And yes, of course -- i diy my node anyway :-) thx. I'll see what/who I can poke 'over there' ...

@ghost
Copy link
Author

ghost commented Jul 9, 2015

for reference:

"io.js crypto lacks standard ed25519 crypto support for ssh, etc. #2144"
nodejs/node#2144

@ghost
Copy link
Author

ghost commented Jul 9, 2015

/cc @mscdex fyi, from io.js #2144 (nodejs/node#2144)

"Maybe the ssh package (https://www.npmjs.com/package/ssh) works for you? It's either that or wait until openssl grows ed25519 support. That probably won't be anytime soon, it's a pretty conservative project."

@ghost ghost closed this as completed Jul 15, 2015
@rafikee
Copy link

rafikee commented Jan 30, 2019

I am getting the same issue in this error: Error:
Cannot parse privateKey: Unsupported key format

I have had no issues using these credentials and key file to connect using other tools such as FileZilla and using SSH in the terminal.

I could not quite comprehend the discussion above but it seems like the type of key I'm using is not supported? here is my config file

{
"protocol": "sftp",
"host": "xx.xxx.xx.xxx",
"port": 22,
"user": "myname",
"pass": "",
"promptForPass": false,
"remote": "/home/myname",
"local": "",
"agent": "",
"privatekey": "/Users/myname/.ssh/keyfile",
"passphrase": "",
"hosthash": "",
"ignorehost": true,
"connTimeout": 10000,
"keepalive": 10000,
"keyboardInteractive": false,
"keyboardInteractiveForPass": false,
"remoteCommand": "",
"remoteShell": "",
"watch": [],
"watchTimeout": 500
}

Cheers

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants