Class: Prof::Matchers::OnlySupportSslWithCipherSet

Inherits:
Object
  • Object
show all
Defined in:
lib/prof/matchers/only_support_ssl_with_cipher_set.rb

Overview

Current problems

  1. The OSX openssl library may not support all of the ciphers that need to be tested for a cipher suite

  2. Some of the ciphers are actually expressions (kEDH+AESGCM) these need to be expanded to the ciphers they represent

Instance Method Summary collapse

Constructor Details

#initialize(cipher_set) ⇒ OnlySupportSslWithCipherSet

Returns a new instance of OnlySupportSslWithCipherSet.



28
29
30
# File 'lib/prof/matchers/only_support_ssl_with_cipher_set.rb', line 28

def initialize(cipher_set)
  @cipher_set = cipher_set
end

Instance Method Details

#failure_messageObject



44
45
46
47
48
49
50
51
52
# File 'lib/prof/matchers/only_support_ssl_with_cipher_set.rb', line 44

def failure_message
  [
    ("The server is missing support for#{RSpec::Matchers::EnglishPhrasing.list(server_missing_supported_ciphers)}" if server_missing_supported_ciphers.any?),
    ("The server supports#{RSpec::Matchers::EnglishPhrasing.list(server_extra_ciphers)} when it should not" if server_extra_ciphers.any?),
    ("The server is missing support for#{RSpec::Matchers::EnglishPhrasing.list(server_missing_supported_protocols)}" if server_missing_supported_protocols.any?),
     ("The server supports#{RSpec::Matchers::EnglishPhrasing.list(server_extra_protocols)} when it should not" if server_extra_protocols.any?),
    ("The server supports HTTP when it should not" if http_enabled)
  ].compact.join("\n")
end

#matches?(https_url) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
37
# File 'lib/prof/matchers/only_support_ssl_with_cipher_set.rb', line 32

def matches?(https_url)
  @https_url    = https_url
  @results      = ssl_results
  @http_enabled = http_connection_accepted?
  results.supports_cipher_set?(cipher_set) && !@http_enabled
end

#with_proxy(proxy) ⇒ Object



39
40
41
42
# File 'lib/prof/matchers/only_support_ssl_with_cipher_set.rb', line 39

def with_proxy(proxy)
  @proxy = proxy
  self
end