summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard Schwab <richard.schwab@valtech.com>2021-01-16 00:31:22 +0100
committerMiklós Fazekas <mfazekas@szemafor.com>2021-03-15 09:49:16 +0100
commitca6d954ae0627570f2efed2bcabb582f27d385ea (patch)
treec2a9f69485d661c51d2b37fd763420fdd33ef2f6 /lib
parentc6a21e5f0a9f0bc92e9c4eb0e17af40d175a97a5 (diff)
downloadnet-ssh-mfazekas/diffie-hellman-group14-sha256.tar.gz
Add support for diffie-hellman-group14-sha256, fixes #794mfazekas/diffie-hellman-group14-sha256
Diffstat (limited to 'lib')
-rw-r--r--lib/net/ssh/transport/algorithms.rb1
-rw-r--r--lib/net/ssh/transport/kex.rb2
-rw-r--r--lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb11
3 files changed, 14 insertions, 0 deletions
diff --git a/lib/net/ssh/transport/algorithms.rb b/lib/net/ssh/transport/algorithms.rb
index 9ab87b6..7408d40 100644
--- a/lib/net/ssh/transport/algorithms.rb
+++ b/lib/net/ssh/transport/algorithms.rb
@@ -41,6 +41,7 @@ module Net
ecdh-sha2-nistp384
ecdh-sha2-nistp256
diffie-hellman-group-exchange-sha256
+ diffie-hellman-group14-sha256
diffie-hellman-group14-sha1],
encryption: %w[aes256-ctr aes192-ctr aes128-ctr],
diff --git a/lib/net/ssh/transport/kex.rb b/lib/net/ssh/transport/kex.rb
index b3571c3..a43d713 100644
--- a/lib/net/ssh/transport/kex.rb
+++ b/lib/net/ssh/transport/kex.rb
@@ -1,5 +1,6 @@
require 'net/ssh/transport/kex/diffie_hellman_group1_sha1'
require 'net/ssh/transport/kex/diffie_hellman_group14_sha1'
+require 'net/ssh/transport/kex/diffie_hellman_group14_sha256'
require 'net/ssh/transport/kex/diffie_hellman_group_exchange_sha1'
require 'net/ssh/transport/kex/diffie_hellman_group_exchange_sha256'
require 'net/ssh/transport/kex/ecdh_sha2_nistp256'
@@ -14,6 +15,7 @@ module Net::SSH::Transport
MAP = {
'diffie-hellman-group1-sha1' => DiffieHellmanGroup1SHA1,
'diffie-hellman-group14-sha1' => DiffieHellmanGroup14SHA1,
+ 'diffie-hellman-group14-sha256' => DiffieHellmanGroup14SHA256,
'diffie-hellman-group-exchange-sha1' => DiffieHellmanGroupExchangeSHA1,
'diffie-hellman-group-exchange-sha256' => DiffieHellmanGroupExchangeSHA256,
'ecdh-sha2-nistp256' => EcdhSHA2NistP256,
diff --git a/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb b/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb
new file mode 100644
index 0000000..7fd985a
--- /dev/null
+++ b/lib/net/ssh/transport/kex/diffie_hellman_group14_sha256.rb
@@ -0,0 +1,11 @@
+require 'net/ssh/transport/kex/diffie_hellman_group14_sha1'
+
+module Net::SSH::Transport::Kex
+ # A key-exchange service implementing the "diffie-hellman-group14-sha256"
+ # key-exchange algorithm.
+ class DiffieHellmanGroup14SHA256 < DiffieHellmanGroup14SHA1
+ def digester
+ OpenSSL::Digest::SHA256
+ end
+ end
+end