summaryrefslogtreecommitdiff
path: root/lib/net/ssh/known_hosts.rb
diff options
context:
space:
mode:
authordelano <delano@solutious.com>2012-05-24 07:51:03 -0400
committerdelano <delano@solutious.com>2012-05-24 07:51:03 -0400
commit17709188e36e701d6f44dd74b61d6b294148956b (patch)
treebcbc3c5c4653dd0de488393d509c0482c08536e0 /lib/net/ssh/known_hosts.rb
parentc6aec69413433966ff169d98cc10c18f220f72a2 (diff)
parent3a74662c52f52c0d1dac69b427c40b7580f12cd1 (diff)
downloadnet-ssh-addalgos.tar.gz
Merged addalgosaddalgos
Diffstat (limited to 'lib/net/ssh/known_hosts.rb')
-rw-r--r--lib/net/ssh/known_hosts.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/net/ssh/known_hosts.rb b/lib/net/ssh/known_hosts.rb
index 7b153d4..7cbbdaf 100644
--- a/lib/net/ssh/known_hosts.rb
+++ b/lib/net/ssh/known_hosts.rb
@@ -11,6 +11,16 @@ module Net; module SSH
# by consumers of the library.
class KnownHosts
class <<self
+
+ if defined?(OpenSSL::PKey::EC)
+ SUPPORTED_TYPE = %w(ssh-rsa ssh-dss
+ ecdsa-sha2-nistp256
+ ecdsa-sha2-nistp384
+ ecdsa-sha2-nistp521)
+ else
+ SUPPORTED_TYPE = %w(ssh-rsa ssh-dss)
+ end
+
# Searches all known host files (see KnownHosts.hostfiles) for all keys
# of the given host. Returns an array of keys found.
def search_for(host, options={})
@@ -104,7 +114,7 @@ module Net; module SSH
scanner.skip(/\s*/)
type = scanner.scan(/\S+/)
- next unless %w(ssh-rsa ssh-dss).include?(type)
+ next unless SUPPORTED_TYPE.include?(type)
scanner.skip(/\s*/)
blob = scanner.rest.unpack("m*").first
@@ -126,4 +136,4 @@ module Net; module SSH
end
end
-end; end \ No newline at end of file
+end; end