Class: Stenohttp2::Common::Sender

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/stenohttp2/common/sender.rb

Instance Method Summary collapse

Constructor Details

#initialize(message:, connection:, identifier:, delay: 0) ⇒ Sender

Returns a new instance of Sender.



20
21
22
23
24
25
# File 'lib/stenohttp2/common/sender.rb', line 20

def initialize(message:, connection:, identifier:, delay: 0)
  @message = message
  @connection = connection
  @identifier = identifier
  @delay = delay
end

Instance Method Details

#callObject

Send the encrypted message over the hidden channel.

Calls to `sleep delay` look silly but they are important because otherwise the whole message would be send at once which would be very suspicious.

The calls to `random_8_byte_string` are used to hide the message better. If you look at the whole exchange it looks like this:

e48ea076 <- top padding a0eb400a c158b6e7 ae419f7a <- here the message starts 289bcdc7 a9121f02 b68c67cf 4ec6ad36 d7aea416 <- here it ends 96a83824 <- bottom padding 142cf021



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/stenohttp2/common/sender.rb', line 47

def call
  add_padding
  sleep delay

  connection.ping(identifier)
  sleep delay

  connection.ping(encoded_message_size)
  sleep delay

  message.parts.each do |part|
    connection.ping(part)
    sleep delay
  end

  add_padding
end