Class: EchSpec::Spec::Spec7_1_14_2_1

Inherits:
WithSocket show all
Defined in:
lib/echspec/spec/7.1-14.2.1.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WithSocket

#initialize, #message_stack, #with_socket

Constructor Details

This class inherits a constructor from EchSpec::Spec::WithSocket

Class Method Details

.spec_groupEchSpec::SpecGroup

Returns:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/echspec/spec/7.1-14.2.1.rb', line 19

def self.spec_group
  SpecGroup.new(
    '7.1-14.2.1',
    [
      SpecCase.new(
        'MUST include the "encrypted_client_hello" extension in its EncryptedExtensions with the "retry_configs" field set to one or more ECHConfig.',
        method(:validate_ee_retry_configs)
      )
    ]
  )
end

.validate_ee_retry_configs(hostname, port, _) ⇒ EchSpec::Ok | Err

Parameters:

  • hostname (String)
  • port (Integer)
  • _ (ECHConfig)

Returns:



36
37
38
# File 'lib/echspec/spec/7.1-14.2.1.rb', line 36

def self.validate_ee_retry_configs(hostname, port, _)
  Spec7_1_14_2_1.new.do_validate_ee_retry_configs(hostname, port)
end

Instance Method Details

#do_validate_ee_retry_configs(hostname, port) ⇒ EchSpec::Ok | Err

Parameters:

  • hostname (String)
  • port (Integer)

Returns:



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/echspec/spec/7.1-14.2.1.rb', line 44

def do_validate_ee_retry_configs(hostname, port)
  with_socket(hostname, port) do |socket|
    recv = TLS13Client.send_ch_with_greased_ech(socket, hostname, @stack)
    ex = recv.extensions[TTTLS13::Message::ExtensionType::ENCRYPTED_CLIENT_HELLO]
    return Err.new('did not send expected alert: encrypted_client_hello', message_stack) \
      unless ex.is_a?(TTTLS13::Message::Extension::ECHEncryptedExtensions)
    return Err.new('ECHConfigs did not have "retry_configs"', message_stack) \
      if ex.retry_configs.nil? || ex.retry_configs.empty?

    Ok.new(nil)
  end
end