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] 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 55
55:           def initialize( bn, digests )
56:             @bn = bn
57: 
58:             @p = @bn.new( P_s, P_r )
59:             @g = G
60: 
61:             @digester = digests.get( "sha1" )
62:           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 206
206:           def exchange_keys( session, data )
207:             data = data.dup
208:             dh = generate_key( session, data )
209: 
210:             buffer = send_kexinit( dh, session )
211: 
212:             result = parse_kex_reply( dh, buffer, session )
213: 
214:             verify_server_key( result[:server_key], session )
215: 
216:             session_id = verify_signature( dh, data, result )
217: 
218:             confirm_newkeys( session )
219: 
220:             return Struct.new( :session_id,
221:               :server_key, :shared_secret, :hashing_algorithm ).new(
222:                 session_id, result[:server_key], result[:shared_secret],
223:                 @digester )
224:           end

[Validate]