tls-map 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/tls-map +26 -1
- data/data/mapping.json +129 -129
- data/data/mapping.marshal +0 -0
- data/data/mapping.md +121 -121
- data/data/mapping.min.json +1 -1
- data/lib/tls_map.rb +3 -0
- data/lib/tls_map/ciphersuiteinfo.rb +121 -0
- data/lib/tls_map/cli.rb +1 -1
- data/lib/tls_map/gnutls.rb +2 -2
- data/lib/tls_map/nss.rb +1 -1
- data/lib/tls_map/openssl.rb +16 -8
- data/lib/tls_map/utils.rb +7 -2
- data/lib/tls_map/version.rb +1 -1
- metadata +5 -4
data/lib/tls_map/cli.rb
CHANGED
@@ -7,7 +7,7 @@ require 'digest'
|
|
7
7
|
module TLSmap
|
8
8
|
# TLS mapping
|
9
9
|
class CLI < App
|
10
|
-
INTEGRITY = '
|
10
|
+
INTEGRITY = '42e44f89550365da2bc8d33d87f88b65d85d6474e90f9edb65e0ea6c78f61a53' # sha2-256
|
11
11
|
|
12
12
|
# Load and parse data from marshalized hash (+data/mapping.marshal+).
|
13
13
|
# It must match the integrity check for security purpose.
|
data/lib/tls_map/gnutls.rb
CHANGED
@@ -9,12 +9,12 @@ module TLSmap
|
|
9
9
|
GNUTLS_URL = 'https://gitlab.com/gnutls/gnutls/raw/master/lib/algorithms/ciphersuites.c'
|
10
10
|
|
11
11
|
def parse_gnutls
|
12
|
-
reg = /(GNUTLS_[a-zA-Z0-9_]+)\s{\s(0x[[:xdigit:]]{2},\
|
12
|
+
reg = /(GNUTLS_[a-zA-Z0-9_]+)\s+{\s?(0x[[:xdigit:]]{2},\s?0x[[:xdigit:]]{2})\s?}/
|
13
13
|
File.read(@gnutls_file.path).scan(reg).each do |alg|
|
14
14
|
codepoint = codepoint_iana(alg[1])
|
15
15
|
name = alg[0][7..]
|
16
16
|
@tls_map.each do |h|
|
17
|
-
h[:gnutls] ||= h[:codepoint] == codepoint ? name : nil
|
17
|
+
h[:gnutls] ||= h[:codepoint] == codepoint.upcase ? name : nil
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/lib/tls_map/nss.rb
CHANGED
@@ -13,7 +13,7 @@ module TLSmap
|
|
13
13
|
def parse_nss
|
14
14
|
File.read(@nss_file.path).scan(/(TLS_[a-zA-Z0-9_]+)\s+0x([[:xdigit:]]{4})/) do |alg|
|
15
15
|
@tls_map.each do |h|
|
16
|
-
h[:nss] ||= h[:codepoint] == alg[1] ? alg[0] : nil
|
16
|
+
h[:nss] ||= h[:codepoint] == alg[1].upcase ? alg[0] : nil
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
data/lib/tls_map/openssl.rb
CHANGED
@@ -1,45 +1,53 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Ruby internal
|
4
|
-
|
5
3
|
# TLS map module
|
6
4
|
module TLSmap
|
7
5
|
# TLS mapping
|
8
6
|
class App
|
9
7
|
OPENSSL_URL = 'https://raw.githubusercontent.com/openssl/openssl/master/include/openssl/tls1.h'
|
8
|
+
OPENSSL_URL2 = 'https://raw.githubusercontent.com/openssl/openssl/master/include/openssl/ssl3.h'
|
10
9
|
|
11
10
|
def raw_data_openssl
|
12
11
|
openssl_h = File.read(@openssl_file.path)
|
12
|
+
openssl_h2 = File.read(@openssl_file2.path)
|
13
13
|
|
14
14
|
ck1 = openssl_h.scan(/(TLS1_CK_[a-zA-Z0-9_]+)\s+0x0300([[:xdigit:]]{4})/)
|
15
15
|
txt1 = openssl_h.scan(/(TLS1_TXT_[a-zA-Z0-9_]+)\s+"([a-zA-Z0-9-]+)"/)
|
16
16
|
ck2 = openssl_h.scan(/(TLS1_3_CK_[a-zA-Z0-9_]+)\s+0x0300([[:xdigit:]]{4})/)
|
17
17
|
rfc2 = openssl_h.scan(/(TLS1_3_RFC_[a-zA-Z0-9_]+)\s+"([a-zA-Z0-9_]+)"/)
|
18
|
-
|
18
|
+
ck3 = openssl_h2.scan(/(SSL3_CK_[a-zA-Z0-9_]+)\s+0x0300([[:xdigit:]]{4})/)
|
19
|
+
txt3 = openssl_h2.scan(/(SSL3_TXT_[a-zA-Z0-9_]+)\s+"([a-zA-Z0-9-]+)"/)
|
20
|
+
{ ck1: ck1, txt1: txt1, ck2: ck2, rfc2: rfc2, ck3: ck3, txt3: txt3 }
|
19
21
|
end
|
20
22
|
|
21
23
|
def clean_raw_data_openssl
|
22
|
-
ck1, txt1, ck2, rfc2 = raw_data_openssl.values
|
24
|
+
ck1, txt1, ck2, rfc2, ck3, txt3 = raw_data_openssl.values
|
23
25
|
|
24
26
|
ck1.map! { |e| [e[0][8..], e[1]] }
|
25
27
|
txt1.map! { |e| [e[0][9..], e[1]] }
|
26
28
|
ck2.map! { |e| [e[0][10..], e[1]] }
|
27
29
|
rfc2.map! { |e| [e[0][11..], e[1]] }
|
30
|
+
ck3.map! { |e| [e[0][8..], e[1]] }
|
31
|
+
txt3.map! { |e| [e[0][9..], e[1]] }
|
28
32
|
|
29
|
-
{ ck1: ck1, txt1: txt1, ck2: ck2, rfc2: rfc2 }
|
33
|
+
{ ck1: ck1, txt1: txt1, ck2: ck2, rfc2: rfc2, ck3: ck3, txt3: txt3 }
|
30
34
|
end
|
31
35
|
|
32
|
-
def data_openssl
|
33
|
-
ck1, txt1, ck2, rfc2 = clean_raw_data_openssl.values
|
36
|
+
def data_openssl # rubocop:disable Metrics/CyclomaticComplexity
|
37
|
+
ck1, txt1, ck2, rfc2, ck3, txt3 = clean_raw_data_openssl.values
|
34
38
|
data = ck1.map { |e| [e[1], txt1.select { |x| x[0] == e[0] }[0][1]] }
|
35
39
|
data += ck2.map { |e| [e[1], rfc2.select { |x| x[0] == e[0] }[0][1]] }
|
40
|
+
data += ck3.map do |e|
|
41
|
+
candidate = txt3.select { |x| x[0] == e[0] }
|
42
|
+
[e[1], candidate.empty? ? nil : candidate[0][1]]
|
43
|
+
end
|
36
44
|
data
|
37
45
|
end
|
38
46
|
|
39
47
|
def parse_openssl
|
40
48
|
data_openssl.each do |alg|
|
41
49
|
@tls_map.each do |h|
|
42
|
-
h[:openssl] ||= h[:codepoint] == alg[0] ? alg[1] : nil
|
50
|
+
h[:openssl] ||= h[:codepoint] == alg[0].upcase ? alg[1] : nil
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
data/lib/tls_map/utils.rb
CHANGED
@@ -6,14 +6,19 @@ require 'tempfile'
|
|
6
6
|
|
7
7
|
# TLS map module
|
8
8
|
module TLSmap
|
9
|
-
#
|
10
|
-
|
9
|
+
# Generic utilities
|
10
|
+
module Utils
|
11
11
|
def tmpfile(name, url)
|
12
12
|
tmp = Tempfile.new(name)
|
13
13
|
tmp.write(Net::HTTP.get(URI(url)))
|
14
|
+
tmp.close
|
14
15
|
tmp
|
15
16
|
end
|
17
|
+
end
|
16
18
|
|
19
|
+
# TLS mapping
|
20
|
+
class App
|
21
|
+
include Utils
|
17
22
|
protected :tmpfile
|
18
23
|
end
|
19
24
|
end
|
data/lib/tls_map/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tls-map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre ZANNI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -129,7 +129,7 @@ dependencies:
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0.9'
|
131
131
|
description: 'CLI & library for mapping TLS cipher algorithm names: IANA, OpenSSL,
|
132
|
-
|
132
|
+
GnuTLS, NSS'
|
133
133
|
email: alexandre.zanni@engineer.com
|
134
134
|
executables:
|
135
135
|
- tls-map
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- data/mapping.md
|
146
146
|
- data/mapping.min.json
|
147
147
|
- lib/tls_map.rb
|
148
|
+
- lib/tls_map/ciphersuiteinfo.rb
|
148
149
|
- lib/tls_map/cli.rb
|
149
150
|
- lib/tls_map/gnutls.rb
|
150
151
|
- lib/tls_map/iana.rb
|
@@ -184,6 +185,6 @@ requirements: []
|
|
184
185
|
rubygems_version: 3.2.15
|
185
186
|
signing_key:
|
186
187
|
specification_version: 4
|
187
|
-
summary: 'CLI & library for mapping TLS cipher algorithm names: IANA, OpenSSL,
|
188
|
+
summary: 'CLI & library for mapping TLS cipher algorithm names: IANA, OpenSSL, GnuTLS,
|
188
189
|
NSS'
|
189
190
|
test_files: []
|