Browse Source

Display curve for ECC key

master
aeris 2 years ago
parent
commit
299725996b
1 changed files with 12 additions and 7 deletions
  1. 12
    7
      lib/cryptcheck/tls.rb

+ 12
- 7
lib/cryptcheck/tls.rb View File

@@ -9,19 +9,24 @@ module CryptCheck
9 9
 
10 10
 		def self.colorize(cipher)
11 11
 			colors = case
12
-						 when /^SSL/ =~ cipher then :critical
13
-						 when :TLSv1_2 == cipher then :good
12
+						 when /^SSL/ =~ cipher
13
+							 :critical
14
+						 when :TLSv1_2 == cipher
15
+							 :good
14 16
 					 end
15 17
 			cipher.to_s.colorize colors
16 18
 		end
17 19
 
18 20
 		def self.key_to_s(key)
19
-			type_color = case key.type
20
-							 when :ecc then :good
21
-							 when :dh then :warning
22
-							 when :dsa then :critical
21
+			size, color = case key.type
22
+							 when :ecc
23
+								 ["#{key.group.curve_name} #{key.size}", :good]
24
+							 when :dh
25
+								 [key.size, :warning]
26
+							 when :dsa
27
+								 [key.size, :critical]
23 28
 						 end
24
-			"#{key.type.to_s.upcase.colorize type_color} #{key.size.to_s.colorize key.status} bits"
29
+			"#{key.type.to_s.upcase.colorize color} #{size.to_s.colorize key.status} bits"
25 30
 		end
26 31
 	end
27 32
 end

Loading…
Cancel
Save