File: test_diffie_hellman_group_exchange_sha256.rb

package info (click to toggle)
ruby-net-ssh 1%3A2.5.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,252 kB
  • sloc: ruby: 12,000; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 1,092 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'common'
require 'net/ssh/transport/kex/diffie_hellman_group_exchange_sha1'
require 'transport/kex/test_diffie_hellman_group_exchange_sha1'

module Transport; module Kex

  class TestDiffieHellmanGroupExchangeSHA256 < TestDiffieHellmanGroupExchangeSHA1
    private

      def subject
        Net::SSH::Transport::Kex::DiffieHellmanGroupExchangeSHA256
      end

      def session_id
        @session_id ||= begin
          buffer = Net::SSH::Buffer.from(:string, packet_data[:client_version_string],
            :string, packet_data[:server_version_string],
            :string, packet_data[:client_algorithm_packet],
            :string, packet_data[:server_algorithm_packet],
            :string, Net::SSH::Buffer.from(:key, server_key),
            :long,   1024,
            :long,   1024,
            :long,   8192,
            :bignum, dh.dh.p,
            :bignum, dh.dh.g,
            :bignum, dh.dh.pub_key,
            :bignum, server_dh_pubkey,
            :bignum, shared_secret)
          OpenSSL::Digest::SHA256.digest(buffer.to_s)
        end
      end
  end

end; end