diff --git a/app/helpers/check_helper.rb b/app/helpers/check_helper.rb
index 6dba24f..5c46219 100644
--- a/app/helpers/check_helper.rb
+++ b/app/helpers/check_helper.rb
@@ -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
diff --git a/app/views/check/show.html.erb b/app/views/check/show.html.erb
index 6db5e20..1dcca01 100644
--- a/app/views/check/show.html.erb
+++ b/app/views/check/show.html.erb
@@ -86,17 +86,15 @@
<% %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? %>
<%= protocol_label protocol %> |
- <% ciphers.each do |cipher|
- cipher = CryptCheck::Tls::Cipher.new protocol, [cipher.name, nil, cipher[:size]], cipher.dh
- %>
+ <% ciphers.each do |cipher| %>
- <%= cipher_name_label cipher, cipher.state %> |
+ <%= cipher_name_label cipher %> |
<%= cipher_size_label cipher %> |
<%= key_label cipher.dh if cipher.dh %> |
<%= cipher_labels cipher %> |
diff --git a/app/views/site/ciphers.html.erb b/app/views/site/ciphers.html.erb
index d5d8c18..de99d35 100644
--- a/app/views/site/ciphers.html.erb
+++ b/app/views/site/ciphers.html.erb
@@ -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| %>
- <% state = cipher.state %>
- <%= cipher_name_label cipher, state %> |
+ <%= cipher_name_label cipher %> |
<%= cipher_size_label cipher %> |
- <%= cipher_labels state %> |
+ <%= cipher_labels cipher %> |
<% end %>
<% end %>