Class: TLSmap::App::Cipher
- Inherits:
-
Object
- Object
- TLSmap::App::Cipher
- Defined in:
- lib/tls_map/app/cipher/cipher.rb
Overview
Manipulate cipher suite information
Instance Attribute Summary collapse
-
#codepoint ⇒ String
readonly
Get the hexadecimal codepoint of the cipher suite.
-
#extended ⇒ Hash
readonly
Get extended information.
-
#gnutls ⇒ String
readonly
Get the GnuTLS name of the cipher suite.
-
#iana ⇒ String
readonly
Get the IANA name of the cipher suite.
-
#nss ⇒ String
readonly
Get the NSS name of the cipher suite.
-
#openssl ⇒ String
readonly
Get the OpenSSL name of the cipher suite.
Instance Method Summary collapse
-
#initialize(type, value, opts = {}) ⇒ Cipher
constructor
Initialize Cipher instance.
-
#insecure? ⇒ Boolean
Is the security level defined to
insecure
?. -
#recommended? ⇒ Boolean
Is the security level defined to
recommended
?. -
#secure? ⇒ Boolean
Is the security level defined to
secure
?. -
#should_i_use? ⇒ Boolean
Is the security level defined to
secure
orrecommended
? It will returnfalse
forweak
andinsecure
cipher suites. -
#vulnerable? ⇒ Boolean
Is the cipher suite vulnerable?.
-
#weak? ⇒ Boolean
Is the security level defined to
weak
?.
Constructor Details
#initialize(type, value, opts = {}) ⇒ Cipher
Initialize TLSmap::App::Cipher instance
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 84 def initialize(type, value, opts = {}) # rubocop:disable Metrics/MethodLength res = if opts[:tls_map].nil? TLSmap::CLI.new.search(type, value) else TLSmap::App.search(opts[:tls_map], type, value) end @codepoint = res[:codepoint] @iana = res[:iana] @openssl = res[:openssl] @gnutls = res[:gnutls] @nss = res[:nss] @extended = opts.dig(:enhanced_data, @iana) end |
Instance Attribute Details
#codepoint ⇒ String (readonly)
Get the hexadecimal codepoint of the cipher suite
13 14 15 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 13 def codepoint @codepoint end |
#extended ⇒ Hash (readonly)
Get extended information
58 59 60 61 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 58 def extended fetch_extended @extended end |
#gnutls ⇒ String (readonly)
Get the GnuTLS name of the cipher suite
25 26 27 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 25 def gnutls @gnutls end |
#iana ⇒ String (readonly)
Get the IANA name of the cipher suite
17 18 19 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 17 def iana @iana end |
#nss ⇒ String (readonly)
Get the NSS name of the cipher suite
29 30 31 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 29 def nss @nss end |
#openssl ⇒ String (readonly)
Get the OpenSSL name of the cipher suite
21 22 23 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 21 def openssl @openssl end |
Instance Method Details
#insecure? ⇒ Boolean
Is the security level defined to insecure
?
115 116 117 118 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 115 def insecure? fetch_extended @extended['security'] == 'insecure' end |
#recommended? ⇒ Boolean
Is the security level defined to recommended
?
129 130 131 132 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 129 def recommended? fetch_extended @extended['security'] == 'recommended' end |
#secure? ⇒ Boolean
Is the security level defined to secure
?
122 123 124 125 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 122 def secure? fetch_extended @extended['security'] == 'secure' end |
#should_i_use? ⇒ Boolean
Is the security level defined to secure
or recommended
?
It will return false
for weak
and insecure
cipher suites.
137 138 139 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 137 def should_i_use? recommended? || secure? end |
#vulnerable? ⇒ Boolean
Is the cipher suite vulnerable?
143 144 145 146 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 143 def vulnerable? fetch_extended !@extended['vulns'].empty? end |
#weak? ⇒ Boolean
Is the security level defined to weak
?
108 109 110 111 |
# File 'lib/tls_map/app/cipher/cipher.rb', line 108 def weak? fetch_extended @extended['security'] == 'weak' end |