Order ciphers by strength

v1
Aeris 2015-09-09 21:41:04 +02:00
rodič 1141af5d9d
revize b20c94ff2d
3 změnil soubory, kde provedl 10 přidání a 12 odebrání

Zobrazit soubor

@ -90,7 +90,8 @@ module CheckHelper
end
end
def cipher_name_label(cipher, state)
def cipher_name_label(cipher)
state = cipher.state
color = case
when !state[:error].empty? then :error
when !state[:danger].empty? then :danger

Zobrazit soubor

@ -86,17 +86,15 @@
</thead>
<tbody>
<% %w(TLSv1_2 TLSv1_1 TLSv1 SSLv3 SSLv2).each do |protocol|
ciphers = @result.ciphers.select { |c| c.protocol == protocol }
.sort { |a, b| -1 * (a['size'] <=> b['size']) }
ciphers = CryptCheck::Tls::Cipher.sort(@result.ciphers.select { |c| c.protocol == protocol }
.collect { |c| CryptCheck::Tls::Cipher.new protocol, [c.name, nil, c[:size]], c.dh })
unless ciphers.empty? %>
<tr>
<th colspan="3"><%= protocol_label protocol %></th>
</tr>
<% ciphers.each do |cipher|
cipher = CryptCheck::Tls::Cipher.new protocol, [cipher.name, nil, cipher[:size]], cipher.dh
%>
<% ciphers.each do |cipher| %>
<tr>
<th><%= cipher_name_label cipher, cipher.state %></th>
<th><%= cipher_name_label cipher %></th>
<td><%= cipher_size_label cipher %></td>
<td><%= key_label cipher.dh if cipher.dh %></td>
<td><%= cipher_labels cipher %></td>

Zobrazit soubor

@ -19,13 +19,12 @@
-->
<%
context.ciphers = 'ALL:COMPLEMENTOFALL'
context.ciphers.collect { |c| CryptCheck::Tls::Cipher.new protocol, c }
.sort { |a, b| -1 * (a.size <=> b.size)}.each do |cipher| %>
ciphers = context.ciphers.collect { |c| CryptCheck::Tls::Cipher.new protocol, c }
CryptCheck::Tls::Cipher.sort(ciphers).each do |cipher| %>
<tr>
<% state = cipher.state %>
<th><%= cipher_name_label cipher, state %></th>
<th><%= cipher_name_label cipher %></th>
<th><%= cipher_size_label cipher %></th>
<th><%= cipher_labels state %></th>
<th><%= cipher_labels cipher %></th>
</tr>
<% end %>
<% end %>