Class: SSLyze::Protocol
- Inherits:
-
Object
- Object
- SSLyze::Protocol
- Defined in:
- lib/sslyze/protocol.rb
Overview
Represents the <sslv2>
, <sslv3>
, <tls1>
, <tls1_1>
, <tlsv1_2>
XML elements.
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
SSL protocol name.
Instance Method Summary collapse
-
#accepted_cipher_suites ⇒ Array<CipherSuite>
The accepted cipher suites.
-
#each_accepted_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every accepted cipher suite.
- #each_error ⇒ Object
-
#each_preferred_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every preferred cipher suite.
-
#each_rejected_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every rejected cipher suite.
-
#initialize(node) ⇒ Protocol
constructor
Initializes the protocol.
-
#preferred_cipher_suites ⇒ Array<CipherSuite>
The preferred cipher suites.
-
#rejected_cipher_suites ⇒ Array<CipherSuite>
The rejected cipher suites.
-
#supported? ⇒ Boolean
Determines whether the protocol is supported.
-
#title ⇒ String
Descriptive title.
Constructor Details
#initialize(node) ⇒ Protocol
Initializes the protocol.
21 22 23 24 |
# File 'lib/sslyze/protocol.rb', line 21 def initialize(node) @node = node @name = @node.name.to_sym end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
SSL protocol name.
13 14 15 |
# File 'lib/sslyze/protocol.rb', line 13 def name @name end |
Instance Method Details
#accepted_cipher_suites ⇒ Array<CipherSuite>
The accepted cipher suites.
92 93 94 |
# File 'lib/sslyze/protocol.rb', line 92 def accepted_cipher_suites each_accepted_cipher_suite.to_a end |
#each_accepted_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every accepted cipher suite.
79 80 81 82 83 84 85 |
# File 'lib/sslyze/protocol.rb', line 79 def each_accepted_cipher_suite return enum_for(__method__) unless block_given? @node.search('acceptedCipherSuites/cipherSuite').each do |cipher_suite| yield CipherSuite.new(cipher_suite) end end |
#each_error ⇒ Object
figure out what <errors />
contains.
40 41 42 |
# File 'lib/sslyze/protocol.rb', line 40 def each_error raise(NotImplementedError,"#{__method__} not implemented") end |
#each_preferred_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every preferred cipher suite.
105 106 107 108 109 110 111 |
# File 'lib/sslyze/protocol.rb', line 105 def each_preferred_cipher_suite return enum_for(__method__) unless block_given? @node.search('preferredCipherSuites/cipherSuite').each do |cipher_suite| yield CipherSuite.new(cipher_suite) end end |
#each_rejected_cipher_suite {|cipher_suite| ... } ⇒ Enumerator
Enumerates over every rejected cipher suite.
53 54 55 56 57 58 59 |
# File 'lib/sslyze/protocol.rb', line 53 def each_rejected_cipher_suite return enum_for(__method__) unless block_given? @node.search('rejectedCipherSuites/cipherSuite').each do |cipher_suite| yield CipherSuite.new(cipher_suite) end end |
#preferred_cipher_suites ⇒ Array<CipherSuite>
The preferred cipher suites.
118 119 120 |
# File 'lib/sslyze/protocol.rb', line 118 def preferred_cipher_suites each_preferred_cipher_suite.to_a end |
#rejected_cipher_suites ⇒ Array<CipherSuite>
The rejected cipher suites.
66 67 68 |
# File 'lib/sslyze/protocol.rb', line 66 def rejected_cipher_suites each_rejected_cipher_suite.to_a end |
#supported? ⇒ Boolean
Determines whether the protocol is supported.
128 129 130 |
# File 'lib/sslyze/protocol.rb', line 128 def supported? each_accepted_cipher_suite.any? end |
#title ⇒ String
Descriptive title.
31 32 33 |
# File 'lib/sslyze/protocol.rb', line 31 def title @title ||= @node['title'] end |