Class | Net::SSH::Transport::PacketStream |
In: |
lib/net/ssh/transport/packet-stream.rb
|
Parent: | Object |
The abstract parent of IncomingPacketStream and OutgoingPacketStream. It represents the common interface of its subclasses.
sequence_number | [R] | the sequence number of the next packet to be processed. |
socket | [W] | the setter for setting the socket to use for IO communication |
Create a new packet stream. The given ciphers and hmacs are factories that are used to initialize the cipher and mac attributes.
# File lib/net/ssh/transport/packet-stream.rb, line 38 38: def initialize( ciphers, hmacs ) 39: @sequence_number = 0 40: 41: @cipher = ciphers.get( "none" ) 42: @hmac = hmacs.get( "none" ) 43: end
Compute the mac for the given payload.
# File lib/net/ssh/transport/packet-stream.rb, line 51 51: def compute_hmac( payload ) 52: @hmac.digest( [ @sequence_number, payload ].pack( "NA*" ) ) 53: end