diff options
Diffstat (limited to 'lib/net/ssh/authentication')
-rw-r--r-- | lib/net/ssh/authentication/key_manager.rb | 2 | ||||
-rw-r--r-- | lib/net/ssh/authentication/session.rb | 16 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lib/net/ssh/authentication/key_manager.rb b/lib/net/ssh/authentication/key_manager.rb index 6c1704e..80bff95 100644 --- a/lib/net/ssh/authentication/key_manager.rb +++ b/lib/net/ssh/authentication/key_manager.rb @@ -222,7 +222,7 @@ module Net identity end - rescue OpenSSL::PKey::RSAError, OpenSSL::PKey::DSAError => e + rescue OpenSSL::PKey::RSAError, OpenSSL::PKey::DSAError, OpenSSL::PKey::ECError => e if ask_passphrase process_identity_loading_error(identity, e) nil diff --git a/lib/net/ssh/authentication/session.rb b/lib/net/ssh/authentication/session.rb index 4470650..f3f18e7 100644 --- a/lib/net/ssh/authentication/session.rb +++ b/lib/net/ssh/authentication/session.rb @@ -128,13 +128,21 @@ module Net; module SSH; module Authentication private + # Returns an array of paths to the key files usually defined + # by system default. + def default_keys + if defined?(OpenSSL::PKey::EC) + %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh/id_ecdsa + ~/.ssh2/id_dsa ~/.ssh2/id_rsa ~/.ssh2/id_ecdsa) + else + %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa) + end + end + # Returns an array of paths to the key files that should be used when # attempting any key-based authentication mechanism. def keys - Array( - options[:keys] || - %w(~/.ssh/id_dsa ~/.ssh/id_rsa ~/.ssh2/id_dsa ~/.ssh2/id_rsa) - ) + Array(options[:keys] || default_keys) end # Returns an array of the key data that should be used when |