A key-exchange service implementing the “diffie-hellman-group-exchange-sha1” key-exchange algorithm.
Build the signature buffer to use when verifying a signature from the server.
# File lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb, line 63 63: def build_signature_buffer(result) 64: response = Net::SSH::Buffer.new 65: response.write_string data[:client_version_string], 66: data[:server_version_string], 67: data[:client_algorithm_packet], 68: data[:server_algorithm_packet], 69: result[:key_blob] 70: response.write_long MINIMUM_BITS, 71: data[:need_bits], 72: MAXIMUM_BITS 73: response.write_bignum dh.p, dh.g, dh.pub_key, 74: result[:server_dh_pubkey], 75: result[:shared_secret] 76: response 77: end
Compute the number of bits needed for the given number of bytes.
# File lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb, line 21 21: def compute_need_bits 22: 23: # for Compatibility: OpenSSH requires (need_bits * 2 + 1) length of parameter 24: need_bits = data[:need_bytes] * 8 * 2 + 1 25: 26: if need_bits < MINIMUM_BITS 27: need_bits = MINIMUM_BITS 28: elsif need_bits > MAXIMUM_BITS 29: need_bits = MAXIMUM_BITS 30: end 31: 32: data[:need_bits ] = need_bits 33: data[:need_bytes] = need_bits / 8 34: end
Returns the INIT/REPLY constants used by this algorithm.
# File lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb, line 57 57: def get_message_types 58: [KEXDH_GEX_INIT, KEXDH_GEX_REPLY] 59: end
Returns the DH key parameters for the given session.
# File lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb, line 37 37: def get_parameters 38: compute_need_bits 39: 40: # request the DH key parameters for the given number of bits. 41: buffer = Net::SSH::Buffer.from(:byte, KEXDH_GEX_REQUEST, :long, MINIMUM_BITS, 42: :long, data[:need_bits], :long, MAXIMUM_BITS) 43: connection.send_message(buffer) 44: 45: buffer = connection.next_message 46: unless buffer.type == KEXDH_GEX_GROUP 47: raise Net::SSH::Exception, "expected KEXDH_GEX_GROUP, got #{buffer.type}" 48: end 49: 50: p = buffer.read_bignum 51: g = buffer.read_bignum 52: 53: [p, g] 54: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.