Skip to content

Cannot decode private key of type ecdsa-sha2-nistp256 #657

Description

@ruslanshelar

Hello everybody! I hope you can help me.
I try to perform capistrana command but get such error message from net-ssh gem.

Net::SSH::Authentication::KeyManagerError: the given identity is known, but the private key could not be loaded: Net::SSH::Exception (Cannot decode private key of type ecdsa-sha2-nistp256)

I have id_ecdsa file with private key. I can connect via ssh to server using this key.

System configuration

  • net-ssh (5.1.0)
  • ruby 2.5.3p105 (2018-10-18 revision 65156) [x64-mingw32]
  • OS: Windows 10

Stack trace

#<Thread:0x00000000049e6ed0@C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
1: from C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in block (2 levels) in execute' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute': Exception while executing on host any.review.linkio.com: the given identity is known, but the pri
vate key could not be loaded: Net::SSH::Exception (Cannot decode private key of type ecdsa-sha2-nistp256) (SSHKit::Runner::ExecuteError)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host any.review.linkio.com: the given identity is known, but the private key could not be loaded: Net::SSH::Exception (Cannot decode private key of type ecdsa-sha2-nistp
256)
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:15:in rescue in block (2 levels) in execute' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:11:in block (2 levels) in execute'

Caused by:
Net::SSH::Authentication::KeyManagerError: the given identity is known, but the private key could not be loaded: Net::SSH::Exception (Cannot decode private key of type ecdsa-sha2-nistp256)
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/key_manager.rb:144:in rescue in sign' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/key_manager.rb:141:in sign'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/methods/publickey.rb:62:in authenticate_with' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/methods/publickey.rb:20:in block in authenticate'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/key_manager.rb:122:in block in each_identity' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/key_manager.rb:119:in each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/key_manager.rb:119:in each_identity' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/methods/publickey.rb:19:in authenticate'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/session.rb:85:in block in authenticate' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/session.rb:71:in each'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh/authentication/session.rb:71:in authenticate' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/net-ssh-5.1.0/lib/net/ssh.rb:246:in start'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/connection_pool.rb:63:in call' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/connection_pool.rb:63:in with'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/netssh.rb:176:in with_ssh' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/netssh.rb:129:in execute_command'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in block in create_command_and_execute' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in tap'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:145:in create_command_and_execute' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:59:in test'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/capistrano-rvm-0.1.2/lib/capistrano/tasks/rvm.rake:21:in block (3 levels) in <top (required)>' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in instance_exec'
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/backends/abstract.rb:29:in run' C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/sshkit-1.18.2/lib/sshkit/runners/parallel.rb:12:in block (2 levels) in execute'

Caused by:
Net::SSH::Exception: Cannot decode private key of type ecdsa-sha2-nistp256

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions