@@ -52,15 +52,15 @@ def strong_ciphers
52
52
# @raise [ArgumentError] if the version supplied is invalid
53
53
# @return [Array] An array of accepted cipher details matching the supplied versions
54
54
def accepted ( version = :all )
55
- enum_ciphers ( :accepted , version )
55
+ enum_ciphers ( :accepted , version )
56
56
end
57
57
58
58
# Returns all rejected ciphers matching the supplied version
59
59
# @param version [Symbol, Array] The SSL Version to filter on
60
60
# @raise [ArgumentError] if the version supplied is invalid
61
61
# @return [Array] An array of rejected cipher details matching the supplied versions
62
62
def rejected ( version = :all )
63
- enum_ciphers ( :rejected , version )
63
+ enum_ciphers ( :rejected , version )
64
64
end
65
65
66
66
def each_accepted ( version = :all )
@@ -160,41 +160,41 @@ def to_s
160
160
table . rows . sort_by! { |row | [ row [ 0 ] , row [ 2 ] , row [ 3 ] ] }
161
161
text = "#{ table . to_s } "
162
162
if @cert
163
- text <<" \n\n #{@cert.to_text}"
163
+ text << " \n \n #{ @cert . to_text } "
164
164
end
165
165
if openssl_sslv2 == false
166
166
text << "\n \n *** WARNING: Your OS hates freedom! Your OpenSSL libs are compiled without SSLv2 support!"
167
167
end
168
168
text
169
- end
170
-
171
- protected
172
-
173
- # @param [Symbol] state Either :accepted or :rejected
174
- # @param [Symbol, Array] version The SSL Version to filter on (:SSLv2:SSLv3,:TLSv1, :all)
175
- # @return [Set] The Set of cipher results matching the filter criteria
176
- def enum_ciphers(state, version = :all)
177
- case version
178
- when Symbol
179
- case version
180
- when :all
181
- return @ciphers.select{|cipher| cipher[:status] == state}
182
- when :SSLv2, :SSLv3, :TLSv1
183
- return @ciphers.select{|cipher| cipher[:status] == state and cipher[:version] == version}
184
- else
185
- raise ArgumentError, "Invalid SSL Version Supplied: #{ version } "
186
- end
187
- when Array
188
- version = version.reject{|v| !(@supported_versions.include? v)}
189
- if version.empty?
190
- return @ciphers.select{|cipher| cipher[:status] == state}
191
- else
192
- return @ciphers.select{|cipher| cipher[:status] == state and version.include? cipher[:version]}
193
- end
194
- else
195
- raise ArgumentError, "Was expecting Symbol or Array and got #{ version . class } "
196
- end
197
- end
169
+ end
170
+
171
+ protected
198
172
173
+ # @param [Symbol] state Either :accepted or :rejected
174
+ # @param [Symbol, Array] version The SSL Version to filter on (:SSLv2:SSLv3,:TLSv1, :all)
175
+ # @return [Set] The Set of cipher results matching the filter criteria
176
+ def enum_ciphers ( state , version = :all )
177
+ case version
178
+ when Symbol
179
+ case version
180
+ when :all
181
+ return @ciphers . select { |cipher | cipher [ :status ] == state }
182
+ when :SSLv2 , :SSLv3 , :TLSv1
183
+ return @ciphers . select { |cipher | cipher [ :status ] == state and cipher [ :version ] == version }
184
+ else
185
+ raise ArgumentError , "Invalid SSL Version Supplied: #{ version } "
186
+ end
187
+ when Array
188
+ version = version . reject { |v | !( @supported_versions . include? v ) }
189
+ if version . empty?
190
+ return @ciphers . select { |cipher | cipher [ :status ] == state }
191
+ else
192
+ return @ciphers . select { |cipher | cipher [ :status ] == state and version . include? cipher [ :version ] }
193
+ end
194
+ else
195
+ raise ArgumentError , "Was expecting Symbol or Array and got #{ version . class } "
196
+ end
197
+ end
198
+
199
+ end
199
200
end
200
- end
0 commit comments