Parent

Class Index [+]

Quicksearch

Net::SSH::Test::Kex

An implementation of a key-exchange strategy specifically for unit tests. (This strategy would never really work against a real SSH server—it makes too many assumptions about the server’s response.)

This registers itself with the transport key-exchange system as the “test” algorithm.

Public Class Methods

new(algorithms, connection, data) click to toggle source

Creates a new instance of the testing key-exchange algorithm with the given arguments.

    # File lib/net/ssh/test/kex.rb, line 21
21:     def initialize(algorithms, connection, data)
22:       @connection = connection
23:     end

Public Instance Methods

exchange_keys() click to toggle source

Exchange keys with the server. This returns a hash of constant values, and does not actually exchange keys.

    # File lib/net/ssh/test/kex.rb, line 27
27:     def exchange_keys
28:       result = Net::SSH::Buffer.from(:byte, NEWKEYS)
29:       @connection.send_message(result)
30: 
31:       buffer = @connection.next_message
32:       raise Net::SSH::Exception, "expected NEWKEYS" unless buffer.type == NEWKEYS
33: 
34:       { :session_id        => "abc-xyz",
35:         :server_key        => OpenSSL::PKey::RSA.new(32),
36:         :shared_secret     => OpenSSL::BN.new("1234567890", 10),
37:         :hashing_algorithm => OpenSSL::Digest::SHA1 }
38:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.