Class: EchSpec::Spec::Spec7_5::IllegalEchClientHello

Inherits:
TTTLS13::Message::Extension::ECHClientHello
  • Object
show all
Defined in:
lib/echspec/spec/7-5.rb

Overview

rubocop: enable Metrics/AbcSize rubocop: enable Metrics/MethodLength

Constant Summary collapse

ILLEGAL_OUTER =
"\x02".freeze
ILLEGAL_INNER =
"\x03".freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new_innerObject



212
213
214
# File 'lib/echspec/spec/7-5.rb', line 212

def self.new_inner
  IllegalEchClientHello.new(type: ILLEGAL_INNER)
end

.new_outer(cipher_suite:, config_id:, enc:, payload:) ⇒ Object



216
217
218
219
220
221
222
223
224
# File 'lib/echspec/spec/7-5.rb', line 216

def self.new_outer(cipher_suite:, config_id:, enc:, payload:)
  IllegalEchClientHello.new(
    type: ILLEGAL_OUTER,
    cipher_suite:,
    config_id:,
    enc:,
    payload:
  )
end

Instance Method Details

#serializeObject



226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/echspec/spec/7-5.rb', line 226

def serialize
  case @type
  when ILLEGAL_OUTER
    binary = @type + @cipher_suite.encode + @config_id.to_uint8 \
             + @enc.prefix_uint16_length + @payload.prefix_uint16_length
  when ILLEGAL_INNER
    binary = @type
  else
    return super
  end

  @extension_type + binary.prefix_uint16_length
end