From 6926f3e7b95acaa484db5a2f21ab9a5051373252 Mon Sep 17 00:00:00 2001 From: Edward Holets Date: Wed, 4 Oct 2017 14:45:08 -0700 Subject: [PATCH 1/2] Remove bogus algorithm type. --- lib/ssh_client_key_api.ex | 2 +- test/ssh_client_key_api_test.exs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ssh_client_key_api.ex b/lib/ssh_client_key_api.ex index 6aaf078..744ebdc 100644 --- a/lib/ssh_client_key_api.ex +++ b/lib/ssh_client_key_api.ex @@ -1,7 +1,7 @@ defmodule SSHClientKeyAPI do @behaviour :ssh_client_key_api - @key_algorithms ~w(ssh-rsa ssh-dsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521)a + @key_algorithms ~w(ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521)a @moduledoc ~S""" diff --git a/test/ssh_client_key_api_test.exs b/test/ssh_client_key_api_test.exs index 6c5c122..f0c1b51 100644 --- a/test/ssh_client_key_api_test.exs +++ b/test/ssh_client_key_api_test.exs @@ -80,7 +80,7 @@ github.com,192.30.252.128 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9 result = SSHClientKeyAPI.is_host_key( @host_key, 'github.com', - :"ssh-dsa", + :"ssh-dss", [key_cb_private: [silently_accept_hosts: false, known_hosts: known_hosts, known_hosts_data: IO.binread(known_hosts, :all)]]) assert result end @@ -89,14 +89,14 @@ github.com,192.30.252.128 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9 result = SSHClientKeyAPI.is_host_key( @host_key, 'other.com', - :"ssh-dsa", + :"ssh-dss", [key_cb_private: [silently_accept_hosts: false, known_hosts: known_hosts, known_hosts_data: IO.binread(known_hosts, :all)]]) refute result end test "user key returns the contents of the key option", %{key: key} do result = SSHClientKeyAPI.user_key( - :"ssh-dsa", + :"ssh-dss", [key_cb_private: [identity: key, identity_data: IO.binread(key, :all)]] ) assert result == {:ok, @decoded_pem} From 72d089a67245d2ddd9ebea5c534c0138fd8cb69f Mon Sep 17 00:00:00 2001 From: Edward Holets Date: Wed, 4 Oct 2017 14:46:09 -0700 Subject: [PATCH 2/2] Switch supported key algorithm list to match OTP. --- lib/ssh_client_key_api.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ssh_client_key_api.ex b/lib/ssh_client_key_api.ex index 744ebdc..83cb3d5 100644 --- a/lib/ssh_client_key_api.ex +++ b/lib/ssh_client_key_api.ex @@ -1,7 +1,7 @@ defmodule SSHClientKeyAPI do @behaviour :ssh_client_key_api - @key_algorithms ~w(ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521)a + @key_algorithms :ssh.default_algorithms()[:public_key] @moduledoc ~S"""