A key-exchange service implementing the "diffie-hellman-group1-sha1" key-exchange algorithm.

Methods
Included Modules
Constants
P_s = "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" + "C4C6628B" "80DC1CD1" "29024E08" "8A67CC74" + "020BBEA6" "3B139B22" "514A0879" "8E3404DD" + "EF9519B3" "CD3A431B" "302B0A6D" "F25F1437" + "4FE1356D" "6D51C245" "E485B576" "625E7EC6" + "F44C42E9" "A637ED6B" "0BFF5CB6" "F406B7ED" + "EE386BFB" "5A899FA5" "AE9F2411" "7C4B1FE6" + "49286651" "ECE65381" "FFFFFFFF" "FFFFFFFF"
  The value of ‘P’, as a string, in hexadecimal
P_r = 16
  The radix in which P_s represents the value of P
G = 2
  The group constant
Attributes
[W] buffers The reference to the buffer factory to use.
[W] host_key_verifier The reference to the host key verifier to use to verify host keys.
[W] keys The reference to the key factory to use.
Public Class methods
new( bn, digests )

Create a new instance of the DiffieHellmanGroup1SHA1 algorithm. The parameters are, respectively, a factory for creating new Bignum instances, and a factory for obtaining digester objects.

    # File lib/net/ssh/transport/kex/dh.rb, line 58
58:           def initialize( bn, digests )
59:             @bn = bn
60: 
61:             @p = @bn.new( P_s, P_r )
62:             @g = G
63: 
64:             @digester = digests.get( "sha1" )
65:           end
Public Instance methods
exchange_keys( session, data )

Perform the key-exchange for the given session, with the given data. The data is a Hash of symbols representing information required by this algorithm, which was acquired during earlier processing. This method will return an object consisting of the following fields:

  • :session_id
  • :server_key
  • :shared_secret
  • :hashing_algorithm

The caller is expected to be able to understand how to use these deliverables.

     # File lib/net/ssh/transport/kex/dh.rb, line 224
224:           def exchange_keys( session, data )
225:             data = data.dup
226:             dh = generate_key( session, data )
227: 
228:             buffer = send_kexinit( dh, session )
229: 
230:             result = parse_kex_reply( dh, buffer, session )
231: 
232:             verify_server_key( result[:server_key], session )
233: 
234:             session_id = verify_signature( dh, data, result )
235: 
236:             confirm_newkeys( session )
237: 
238:             return Struct.new( :session_id,
239:               :server_key, :shared_secret, :hashing_algorithm ).new(
240:                 session_id, result[:server_key], result[:shared_secret],
241:                 @digester )
242:           end
generate_key_fingerprint(key)
     # File lib/net/ssh/transport/kex/dh.rb, line 170
170:           def generate_key_fingerprint(key)
171:             writer = @buffers.writer
172:             writer.write_key(key)
173: 
174:             blob = writer.to_s
175:             fingerprint = OpenSSL::Digest::MD5.hexdigest(blob).scan(/../).join(":")
176: 
177:             [blob, fingerprint]
178:           rescue ::Exception => e
179:             [nil, "(could not generate fingerprint: #{e.message})"]
180:           end