Class: TLSmap::App
- Inherits:
-
Object
- Object
- TLSmap::App
- Defined in:
- lib/tls_map.rb,
lib/tls_map/nss.rb,
lib/tls_map/iana.rb,
lib/tls_map/gnutls.rb,
lib/tls_map/output.rb,
lib/tls_map/openssl.rb,
lib/tls_map/extractor.rb,
lib/tls_map/ciphersuiteinfo.rb
Overview
TLS mapping
Direct Known Subclasses
Defined Under Namespace
Constant Summary collapse
- NSS_URL =
Timeout https://hg.mozilla.org/projects/nss/raw-file/tip/lib/ssl/sslproto.h so use github RO mirror instead.
'https://raw.githubusercontent.com/nss-dev/nss/master/lib/ssl/sslproto.h'
- IANA_URL =
'https://www.iana.org/assignments/tls-parameters/tls-parameters-4.csv'
- GNUTLS_URL =
'https://gitlab.com/gnutls/gnutls/raw/master/lib/algorithms/ciphersuites.c'
- OPENSSL_URL =
'https://raw.githubusercontent.com/openssl/openssl/master/include/openssl/tls1.h'
- OPENSSL_URL2 =
'https://raw.githubusercontent.com/openssl/openssl/master/include/openssl/ssl3.h'
Instance Method Summary collapse
-
#bulk_search(critera, file, output = :all) ⇒ Array<Hash>
Search for corresponding cipher algorithms in other libraries in bulk.
-
#export(filename, format) ⇒ Object
Export the mapping to a file, supporting various formats.
-
#initialize ⇒ App
constructor
Will automatically fetch source files and parse them.
-
#search(critera, term, output = :all) ⇒ Hash
Search for corresponding cipher algorithms in other libraries.
Constructor Details
#initialize ⇒ App
Will automatically fetch source files and parse them.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tls_map.rb', line 21 def initialize @iana_file = Utils.tmpfile('iana', IANA_URL) @openssl_file = Utils.tmpfile('openssl', OPENSSL_URL) @openssl_file2 = Utils.tmpfile('openssl', OPENSSL_URL2) @gnutls_file = Utils.tmpfile('gnutls', GNUTLS_URL) @nss_file = Utils.tmpfile('nss', NSS_URL) @tls_map = [] parse end |
Instance Method Details
#bulk_search(critera, file, output = :all) ⇒ Array<Hash>
Search for corresponding cipher algorithms in other libraries in bulk
67 68 69 70 71 72 73 |
# File 'lib/tls_map.rb', line 67 def bulk_search(critera, file, output = :all) res = [] File.foreach(file) do |line| res.push(search(critera, line.chomp, output)) end res end |
#export(filename, format) ⇒ Object
Export the mapping to a file, supporting various formats.
41 42 43 44 45 46 47 48 49 |
# File 'lib/tls_map/output.rb', line 41 def export(filename, format) case format when :markdown then output_markdown(filename) when :json_pretty then output_json_pretty(filename) when :json_compact then output_json_compact(filename) when :marshal then output_marshal(filename) else raise "Wrong format: #{format}" end end |
#search(critera, term, output = :all) ⇒ Hash
Search for corresponding cipher algorithms in other libraries
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/tls_map.rb', line 47 def search(critera, term, output = :all) @tls_map.each do |alg| term = term.upcase if critera == :codepoint next unless alg[critera] == term return alg if output == :all return { output => alg[output] } end {} end |