Class: Net::SSH::Transport::Kex::EcdhSHA2NistP256

Inherits:
DiffieHellmanGroup1SHA1 show all
Includes:
Loggable, Constants
Defined in:
lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb

Overview

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

Direct Known Subclasses

EcdhSHA2NistP384, EcdhSHA2NistP521

Constant Summary

Constants included from Constants

Constants::DEBUG, Constants::DISCONNECT, Constants::IGNORE, Constants::KEXDH_INIT, Constants::KEXDH_REPLY, Constants::KEXECDH_INIT, Constants::KEXECDH_REPLY, Constants::KEXINIT, Constants::NEWKEYS, Constants::SERVICE_ACCEPT, Constants::SERVICE_REQUEST, Constants::UNIMPLEMENTED

Constants inherited from DiffieHellmanGroup1SHA1

DiffieHellmanGroup1SHA1::G, DiffieHellmanGroup1SHA1::P_r, DiffieHellmanGroup1SHA1::P_s

Instance Attribute Summary collapse

Attributes included from Loggable

#logger

Attributes inherited from DiffieHellmanGroup1SHA1

#algorithms, #connection, #data, #dh, #g, #p

Instance Method Summary collapse

Methods included from Loggable

#debug, #error, #fatal, #info, #lwarn

Methods inherited from DiffieHellmanGroup1SHA1

#exchange_keys

Constructor Details

#initialize(algorithms, connection, data) ⇒ EcdhSHA2NistP256

Returns a new instance of EcdhSHA2NistP256.


21
22
23
24
25
26
27
28
29
# 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

Instance Attribute Details

#ecdhObject (readonly)

Returns the value of attribute ecdh


11
12
13
# File 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb', line 11

def ecdh
  @ecdh
end

Instance Method Details

#curve_nameObject


17
18
19
# File 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb', line 17

def curve_name
  OpenSSL::PKey::EC::CurveNameAlias['nistp256']
end

#digesterObject


13
14
15
# File 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb', line 13

def digester
  OpenSSL::Digest::SHA256
end