class Net::SSH::Transport::Kex::EcdhSHA2NistP256

A key-exchange service implementing the “ecdh-sha2-nistp256” key-exchange algorithm. (defined in RFC 5656)

Attributes

ecdh[R]

Public Class Methods

new(algorithms, connection, data) click to toggle source
# File lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb, line 21
def initialize(algorithms, connection, data)
  @algorithms = algorithms
  @connection = connection

  @digester = digester
  @data = data.dup
  @ecdh = generate_key
  @logger = @data.delete(:logger)
end

Public Instance Methods

curve_name() click to toggle source
# File lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb, line 17
def curve_name
  OpenSSL::PKey::EC::CurveNameAlias['nistp256']
end
digester() click to toggle source
# File lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb, line 13
def digester
  OpenSSL::Digest::SHA256
end

Private Instance Methods

build_signature_buffer(result) click to toggle source
# File lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb, line 37
def build_signature_buffer(result)
  response = Net::SSH::Buffer.new
  response.write_string data[:client_version_string],
                        data[:server_version_string],
                        data[:client_algorithm_packet],
                        data[:server_algorithm_packet],
                        result[:key_blob],
                        ecdh.public_key.to_bn.to_s(2),
                        result[:server_ecdh_pubkey]
  response.write_bignum result[:shared_secret]
  response
end
get_message_types() click to toggle source
# File lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb, line 33
def get_message_types
  [KEXECDH_INIT, KEXECDH_REPLY]
end