class SSLyze::XML::Protocol

Represents the `<sslv2>`, `<sslv3>`, `<tls1>`, `<tls1_1>`, `<tlsv1_2>` XML elements.

Attributes

name[R]

SSL protocol name.

@return [Symbol]

Public Class Methods

new(node) click to toggle source

Initializes the protocol.

@param [Nokogiri::XML::Node] node

The XML element.
# File lib/sslyze/xml/protocol.rb, line 26
def initialize(node)
  @node = node
  @name = @node.name.to_sym
end

Public Instance Methods

accepted_cipher_suites() click to toggle source

The accepted cipher suites.

@return [Array<CipherSuite>]

# File lib/sslyze/xml/protocol.rb, line 94
def accepted_cipher_suites
  each_accepted_cipher_suite.to_a
end
each_accepted_cipher_suite() { |cipher_suite| ... } click to toggle source

Enumerates over every accepted cipher suite.

@yield [cipher_suite]

@yieldparam [CipherSuite] cipher_suite

@return [Enumerator]

# File lib/sslyze/xml/protocol.rb, line 81
def each_accepted_cipher_suite
  return enum_for(__method__) unless block_given?

  @node.xpath('acceptedCipherSuites/cipherSuite').each do |cipher_suite|
    yield CipherSuite.new(cipher_suite)
  end
end
each_error() { |cipher_suite| ... } click to toggle source

Enumerates over every errored cipher suite.

@yield [cipher_suite]

@yieldparam [CipherSuite] cipher_suite

@return [Enumerator]

@since 1.0.0

# File lib/sslyze/xml/protocol.rb, line 122
def each_error
  return enum_for(__method__) unless block_given?

  @node.xpath('errors/cipherSuite').each do |cipher_suite|
    yield CipherSuite.new(cipher_suite)
  end
end
each_rejected_cipher_suite() { |cipher_suite| ... } click to toggle source

Enumerates over every rejected cipher suite.

@yield [cipher_suite]

@yieldparam [CipherSuite] cipher_suite

@return [Enumerator]

# File lib/sslyze/xml/protocol.rb, line 55
def each_rejected_cipher_suite
  return enum_for(__method__) unless block_given?

  @node.xpath('rejectedCipherSuites/cipherSuite').each do |cipher_suite|
    yield CipherSuite.new(cipher_suite)
  end
end
errors() click to toggle source

The errored cipher suites.

@return [Array<CipherSuite>]

@since 1.0.0

# File lib/sslyze/xml/protocol.rb, line 137
def errors
  each_error.to_a
end
is_protocol_supported?() click to toggle source

Determines whether the protocol is supported.

@return [Boolean]

Specifies whether any cipher suite was accepted.

@since 1.0.0

# File lib/sslyze/xml/protocol.rb, line 39
def is_protocol_supported?
  Boolean[@node['isProtocolSupported']]
end
Also aliased as: is_supported?, supported?
is_supported?()
preferred_cipher_suite() click to toggle source

The preferred cipher suite.

@return [CipherSuite, nil]

@since 1.0.0

# File lib/sslyze/xml/protocol.rb, line 105
def preferred_cipher_suite
  @preferred_cipher_suite ||= if (element = @node.at_xpath('preferredCipherSuite/cipherSuite'))
                                CipherSuite.new(element)
                              end
end
rejected_cipher_suites() click to toggle source

The rejected cipher suites.

@return [Array<CipherSuite>]

# File lib/sslyze/xml/protocol.rb, line 68
def rejected_cipher_suites
  each_rejected_cipher_suite.to_a
end
supported?()