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

Uncaught Error: Cannot parse privateKey: Unsupported key format #72

Open
JamesBedont opened this issue May 16, 2015 · 16 comments
Open

Uncaught Error: Cannot parse privateKey: Unsupported key format #72

JamesBedont opened this issue May 16, 2015 · 16 comments
Labels

Comments

@JamesBedont
Copy link

update: using a PUTTY generated .ppy private key

  1. I added a sftp host then did a 'Remote Edit Browse' command
  2. selected the host that I previously added
  3. it will try to connect and eventual time out while waiting for handshake
  4. I created my private key the most generic way possible with PUTTY I don't know how it could be in an un-supported format to be honest. Also this same private key works for FileZilla SFTP connecting. this private key also works with sublime text sftp plugin.

Atom Version: 0.199.0
System: Microsoft Windows 7 Home Premium
Thrown From: remote-edit package, v1.7.2

Stack Trace

Uncaught Error: Cannot parse privateKey: Unsupported key format

At C:\Users\James\.atom\packages\remote-edit\node_modules\ssh2\lib\Connection.js:287

Error: Cannot parse privateKey: Unsupported key format
  at Connection.connect (C:\Users\James\.atom\packages\remote-edit\node_modules\ssh2\lib\Connection.js:287:13)
  at C:\Users\James\.atom\packages\remote-edit\lib\model\sftp-host.coffee:116:23
  at fn (C:\Users\James\AppData\Local\atom\app-0.199.0\resources\app.asar\node_modules\request\node_modules\form-data\node_modules\async\lib\async.js:641:34)
  at Immediate._onImmediate (C:\Users\James\AppData\Local\atom\app-0.199.0\resources\app.asar\node_modules\request\node_modules\form-data\node_modules\async\lib\async.js:557:34)
  at processImmediate [as _immediateCallback] (timers.js:369:17)

Commands

     -8:30 remote-edit:new-host-sftp (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -8:22.3.0 core:paste (atom-text-editor.editor.mini.is-focused)
  6x -8:19.3.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -7:38.8.0 core:paste (atom-text-editor.editor.mini.is-focused)
     -7:37.1.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -7:19.2.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -7:17 core:backspace (atom-text-editor.editor.mini.is-focused)
     -7:11.6.0 remote-edit:browse (atom-text-editor.editor)
     -6:27 command-palette:toggle (atom-text-editor.editor.is-focused)
     -6:23 remote-edit:show-open-files (atom-text-editor.editor)
     -6:20.2.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -6:16.6.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -6:16.6.0 remote-edit:browse (atom-text-editor.editor)
     -0:23.9.0 command-palette:toggle (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
     -0:17.4.0 remote-edit:browse (atom-text-editor.editor.is-focused)
  4x -0:13.8.0 core:backspace (atom-text-editor.editor.mini.is-focused)

Config

{
  "core": {},
  "remote-edit": {}
}

Installed Packages

# User
color-picker, v1.7.0
remote-edit, v1.7.2

# Dev
No dev packages
@sveale
Copy link
Owner

sveale commented May 16, 2015

Is it a putty or openssh style key? (what's the file ending)

@JamesBedont
Copy link
Author

wow I really should have included that information sorry. It is PUTTY generated .ppy extension.

@sveale
Copy link
Owner

sveale commented May 16, 2015

I don't know if that is supported by the underlying ssh library. According to this thread mscdex/ssh2#191 it should be supported, but I'm not sure. I don't have access to a Windows machine at the moment. I think the easiest option would be to convert the key to an openssh style key.

---- James Bedont skrev ----

wow I really should have included that information sorry. It is PUTTY generated .ppy extension.


Reply to this email directly or view it on GitHub.

@JamesBedont
Copy link
Author

Thanks I'll look into doing that.

@JamesBedont
Copy link
Author

after using PUTTYGEN to convert to an open ssh key I get the following error. I'm not sure if this is something you are concerned with but I felt like I may as well follow up.

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 0.199.0
System: Microsoft Windows 7 Home Premium
Thrown From: remote-edit package, v1.7.2

Stack Trace

Uncaught Error: privateKey value does not contain a (valid) private key

At C:\Users\James\.atom\packages\remote-edit\node_modules\ssh2\lib\Connection.js:289

Error: privateKey value does not contain a (valid) private key
  at Connection.connect (C:\Users\James\.atom\packages\remote-edit\node_modules\ssh2\lib\Connection.js:289:13)
  at C:\Users\James\.atom\packages\remote-edit\lib\model\sftp-host.coffee:116:23
  at fn (C:\Users\James\AppData\Local\atom\app-0.199.0\resources\app.asar\node_modules\request\node_modules\form-data\node_modules\async\lib\async.js:641:34)
  at Immediate._onImmediate (C:\Users\James\AppData\Local\atom\app-0.199.0\resources\app.asar\node_modules\request\node_modules\form-data\node_modules\async\lib\async.js:557:34)
  at processImmediate [as _immediateCallback] (timers.js:369:17)

Commands

     -3:16.3.0 core:paste (atom-text-editor.editor.mini.is-focused)
     -2:51.2.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -2:48.2.0 core:confirm (atom-text-editor.editor.mini.is-focused)
     -2:48.1.0 remote-edit:browse (atom-text-editor.editor)
     -2:37.7.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -2:30.2.0 remote-edit:new-host-sftp (atom-text-editor.editor)
     -2:24.3.0 core:paste (atom-text-editor.editor.mini.is-focused)
     -2:20.4.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -2:10.1.0 editor:consolidate-selections (atom-text-editor.editor.mini.is-focused)
  6x -2:01.8.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -1:49.1.0 command-palette:toggle (atom-text-editor.editor.is-focused)
     -1:47 core:confirm (atom-text-editor.editor.mini.is-focused)
     -1:47 remote-edit:browse (atom-text-editor.editor)
     -0:29.5.0 command-palette:toggle (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
  3x -0:26.9.0 core:backspace (atom-text-editor.editor.mini.is-focused)
     -0:24.8.0 remote-edit:browse (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)

Config

{
  "core": {},
  "remote-edit": {}
}

Installed Packages

# User
minimap, v4.8.0
remote-edit, v1.7.2

# Dev
No dev packages

@sveale
Copy link
Owner

sveale commented May 19, 2015

Appreciate you letting me know :)
Will take a look at it when it's convenient.
Is the key protected by a passphrase? What specs were the key created with? (algorithm, length)

@sveale sveale added the bug label Jul 8, 2015
@phyllisstein
Copy link

Hey @sveale! I just caught the same exception on my Mac. It's probably my own fault—I'm using an Ed25519 key pair, which I imagine might have limited support—but thought I'd give you a heads-up anyway. I think the Sublime SFTP package and a number of other SFTP applications I use get around this kind of thing by going through the system ssh-agent—any chance that's a potential solution?

@sveale
Copy link
Owner

sveale commented Jul 22, 2015

Hi @phyllisstein you can use ssh agent with this plug-in as well, just select "agent" as authentication method on your host. In regards to the exception it's really hard for me to test without the key. If you want you could create a dummy key pair of same configuration and upload it here and I could check it out. What makes this so hard is that the underlying ssh connection is handled by an entirely different package, ie. If the issue is with that package I don't have the expertise to do anything but file a bug :-)

@phyllisstein
Copy link

HAH! Oh my goodness, thank you for being so polite about pointing out that obvious oversight. "Agent" auth doesn't quite work on OS X, unfortunately:

Error: All configured authentication methods failed
  at tryNextAuth (/Users/danielsh/.atom/packages/remote-edit/node_modules/ssh2/lib/client.js:284:17)
  at SSH2Stream.onUSERAUTH_FAILURE (/Users/danielsh/.atom/packages/remote-edit/node_modules/ssh2/lib/client.js:463:5)
  at emitTwo (events.js:87:13)
  at SSH2Stream.emit (events.js:169:7)
  at parsePacket (/Users/danielsh/.atom/packages/remote-edit/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:3649:10)
  at SSH2Stream._transform (/Users/danielsh/.atom/packages/remote-edit/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:555:13)
  at SSH2Stream.Transform._read [as __read] (_stream_transform.js:167:10)
  at SSH2Stream._read (/Users/danielsh/.atom/packages/remote-edit/node_modules/ssh2/node_modules/ssh2-streams/lib/ssh.js:213:15)
  at SSH2Stream.Transform._write (_stream_transform.js:155:12)
  at doWrite (_stream_writable.js:295:12)
  at writeOrBuffer (_stream_writable.js:282:5)
  at SSH2Stream.Writable.write (_stream_writable.js:210:11)
  at Socket.ondata (_stream_readable.js:524:20)
  at emitOne (events.js:77:13)
  at Socket.emit (events.js:166:7)
  at readableAddChunk (_stream_readable.js:146:16)
  at Socket.Readable.push (_stream_readable.js:109:10)
  at TCP.onread (net.js:517:20)

My current best guess is that it's failing because the Atom process doesn't inherit the SSH_AUTH_SOCK envvar—if that's the case, I'll try to submit a PR in the next couple of days.

As for Ed25519, I've created a Gist with a throwaway keypair here: https://gist.github.com/phyllisstein/07fe1bee468ba92cb534. (If you wanna save some copy-pasting, you can grab the originals at https://cloudup.com/cN4xpjiyTBQ.) And no worries: I completely understand the aggravation of depending on third-party packages more capable than one's own.

@sveale
Copy link
Owner

sveale commented Jul 25, 2015

@phyllisstein I think the issue here is that the underlying ssh module (ssh2) doesn't support Ed25519. I imagine that is why using an agent fails as well (this is just a guess).

@heubergen
Copy link

Just want to report that I have the same problem and I'm also using a Ed25519 with the auth method key.
I' think we have to wait till ssh2 support it.

The tracking issue from there can you find here.

@akulbe
Copy link

akulbe commented Mar 19, 2016

I was trying this same thing with an ECDSA key type. Same result.

@szczad
Copy link

szczad commented Nov 16, 2017

Same thing here. I'm trying to use the module with ECDSA keys and get errors during connection.

@wskinner
Copy link

Any updates here, as it has been 1.5 years? As of 1.23.1, I can't connect to a server with an ed25519 key.

@funkyfuture
Copy link

i seem to have this issue with a ed25519 key.

@dmkishi
Copy link

dmkishi commented May 23, 2019

Likewise, would be great to see support for Ed25519 keys.

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

No branches or pull requests

9 participants