tttls1.3 0.2.3 → 0.2.4
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/example/https_client.rb +4 -1
- data/example/https_client_using_0rtt.rb +3 -1
- data/example/https_client_using_hrr.rb +2 -1
- data/example/https_client_using_hrr_and_ticket.rb +3 -1
- data/example/https_client_using_ticket.rb +3 -1
- data/example/https_server.rb +5 -2
- data/interop/server_spec.rb +9 -2
- data/lib/tttls1.3/client.rb +0 -5
- data/lib/tttls1.3/connection.rb +6 -0
- data/lib/tttls1.3/server.rb +6 -5
- data/lib/tttls1.3/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26abf6610ea39c5b35e874bab7e1226afee77c3209dd2ddde497d731bb6fc64b
|
4
|
+
data.tar.gz: 13a8a522e126dc29993f6bfef96a59556f043910541decf7224c15db84cfb28d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 879a7c9be73deec93e4eff0ee0a0339c2464ad6c4139d5c8da4ad8da06cf8fcdf9bbd6ecef6baeda2f35483d88c91b61deaed17e7ca7a2d25cc105f339d242ce
|
7
|
+
data.tar.gz: 44ad60dff635a9ac7a980605ab736f52b67b94d806fa186e86ff022ff82bc712abf9ce215714052787188b35617e1f527534115d6fbb2cc880d5b32dce9df591
|
data/example/https_client.rb
CHANGED
@@ -7,7 +7,10 @@ hostname, port = (ARGV[0] || 'localhost:4433').split(':')
|
|
7
7
|
req = simple_http_request(hostname)
|
8
8
|
|
9
9
|
socket = TCPSocket.new(hostname, port)
|
10
|
-
settings = {
|
10
|
+
settings = {
|
11
|
+
ca_file: __dir__ + '/../tmp/ca.crt',
|
12
|
+
alpn: ['http/1.1', 'http/1.0']
|
13
|
+
}
|
11
14
|
client = TTTLS13::Client.new(socket, hostname, settings)
|
12
15
|
client.connect
|
13
16
|
client.write(req)
|
@@ -7,7 +7,8 @@ hostname, port = (ARGV[0] || 'localhost:4433').split(':')
|
|
7
7
|
req = simple_http_request(hostname)
|
8
8
|
|
9
9
|
settings_2nd = {
|
10
|
-
ca_file: __dir__ + '/../tmp/ca.crt'
|
10
|
+
ca_file: __dir__ + '/../tmp/ca.crt',
|
11
|
+
alpn: ['http/1.1', 'http/1.0']
|
11
12
|
}
|
12
13
|
process_new_session_ticket = proc do |nst, rms, cs|
|
13
14
|
return if Time.now.to_i - nst.timestamp > nst.ticket_lifetime
|
@@ -21,6 +22,7 @@ process_new_session_ticket = proc do |nst, rms, cs|
|
|
21
22
|
end
|
22
23
|
settings_1st = {
|
23
24
|
ca_file: __dir__ + '/../tmp/ca.crt',
|
25
|
+
alpn: ['http/1.1', 'http/1.0'],
|
24
26
|
process_new_session_ticket: process_new_session_ticket
|
25
27
|
}
|
26
28
|
|
@@ -9,7 +9,8 @@ req = simple_http_request(hostname)
|
|
9
9
|
socket = TCPSocket.new(hostname, port)
|
10
10
|
settings = {
|
11
11
|
ca_file: __dir__ + '/../tmp/ca.crt',
|
12
|
-
key_share_groups: [] # empty KeyShareClientHello.client_shares
|
12
|
+
key_share_groups: [], # empty KeyShareClientHello.client_shares
|
13
|
+
alpn: ['http/1.1', 'http/1.0']
|
13
14
|
}
|
14
15
|
client = TTTLS13::Client.new(socket, hostname, settings)
|
15
16
|
client.connect
|
@@ -7,7 +7,8 @@ hostname, port = (ARGV[0] || 'localhost:4433').split(':')
|
|
7
7
|
req = simple_http_request(hostname)
|
8
8
|
|
9
9
|
settings_2nd = {
|
10
|
-
ca_file: __dir__ + '/../tmp/ca.crt'
|
10
|
+
ca_file: __dir__ + '/../tmp/ca.crt',
|
11
|
+
alpn: ['http/1.1', 'http/1.0']
|
11
12
|
}
|
12
13
|
process_new_session_ticket = proc do |nst, rms, cs|
|
13
14
|
return if Time.now.to_i - nst.timestamp > nst.ticket_lifetime
|
@@ -22,6 +23,7 @@ process_new_session_ticket = proc do |nst, rms, cs|
|
|
22
23
|
end
|
23
24
|
settings_1st = {
|
24
25
|
ca_file: __dir__ + '/../tmp/ca.crt',
|
26
|
+
alpn: ['http/1.1', 'http/1.0'],
|
25
27
|
process_new_session_ticket: process_new_session_ticket
|
26
28
|
}
|
27
29
|
|
@@ -7,7 +7,8 @@ hostname, port = (ARGV[0] || 'localhost:4433').split(':')
|
|
7
7
|
req = simple_http_request(hostname)
|
8
8
|
|
9
9
|
settings_2nd = {
|
10
|
-
ca_file: __dir__ + '/../tmp/ca.crt'
|
10
|
+
ca_file: __dir__ + '/../tmp/ca.crt',
|
11
|
+
alpn: ['http/1.1', 'http/1.0']
|
11
12
|
}
|
12
13
|
process_new_session_ticket = proc do |nst, rms, cs|
|
13
14
|
return if Time.now.to_i - nst.timestamp > nst.ticket_lifetime
|
@@ -21,6 +22,7 @@ process_new_session_ticket = proc do |nst, rms, cs|
|
|
21
22
|
end
|
22
23
|
settings_1st = {
|
23
24
|
ca_file: __dir__ + '/../tmp/ca.crt',
|
25
|
+
alpn: ['http/1.1', 'http/1.0'],
|
24
26
|
process_new_session_ticket: process_new_session_ticket
|
25
27
|
}
|
26
28
|
|
data/example/https_server.rb
CHANGED
@@ -6,8 +6,11 @@ require_relative 'helper'
|
|
6
6
|
port = ARGV[0] || 4433
|
7
7
|
|
8
8
|
tcpserver = TCPServer.open(port)
|
9
|
-
settings = {
|
10
|
-
|
9
|
+
settings = {
|
10
|
+
crt_file: __dir__ + '/../tmp/server.crt',
|
11
|
+
key_file: __dir__ + '/../tmp/server.key',
|
12
|
+
alpn: ['http/1.1', 'http/1.0']
|
13
|
+
}
|
11
14
|
|
12
15
|
# rubocop: disable Metrics/BlockLength
|
13
16
|
loop do
|
data/interop/server_spec.rb
CHANGED
@@ -149,14 +149,21 @@ RSpec.describe Server do
|
|
149
149
|
'-groups P-256:P-384:P-521 -alpn http/1.1',
|
150
150
|
FIXTURES_DIR + '/rsa_rsa.crt',
|
151
151
|
FIXTURES_DIR + '/rsa_rsa.key',
|
152
|
-
alpn: 'http/1.1'
|
152
|
+
alpn: ['http/1.1']
|
153
|
+
],
|
154
|
+
[
|
155
|
+
true,
|
156
|
+
'-groups P-256:P-384:P-521',
|
157
|
+
FIXTURES_DIR + '/rsa_rsa.crt',
|
158
|
+
FIXTURES_DIR + '/rsa_rsa.key',
|
159
|
+
alpn: ['http/1.1']
|
153
160
|
],
|
154
161
|
[
|
155
162
|
false,
|
156
163
|
'-groups P-256:P-384:P-521 -alpn foo',
|
157
164
|
FIXTURES_DIR + '/rsa_rsa.crt',
|
158
165
|
FIXTURES_DIR + '/rsa_rsa.key',
|
159
|
-
alpn: 'http/1.1'
|
166
|
+
alpn: ['http/1.1']
|
160
167
|
]
|
161
168
|
# rubocop: enable Metrics/LineLength
|
162
169
|
].each do |normal, opt, crt, key, settings|
|
data/lib/tttls1.3/client.rb
CHANGED
data/lib/tttls1.3/connection.rb
CHANGED
@@ -23,6 +23,7 @@ module TTTLS13
|
|
23
23
|
@signature_scheme = nil # TTTLS13::SignatureScheme
|
24
24
|
@state = 0 # ClientState or ServerState
|
25
25
|
@send_record_size = Message::DEFAULT_RECORD_SIZE_LIMIT
|
26
|
+
@alpn = nil # String
|
26
27
|
end
|
27
28
|
|
28
29
|
# @raise [TTTLS13::Error::ConfigError]
|
@@ -95,6 +96,11 @@ module TTTLS13
|
|
95
96
|
@signature_scheme
|
96
97
|
end
|
97
98
|
|
99
|
+
# @return [String]
|
100
|
+
def negotiated_alpn
|
101
|
+
@alpn
|
102
|
+
end
|
103
|
+
|
98
104
|
private
|
99
105
|
|
100
106
|
# @param cipher_suite [TTTLS13::CipherSuite]
|
data/lib/tttls1.3/server.rb
CHANGED
@@ -153,11 +153,12 @@ module TTTLS13
|
|
153
153
|
terminate(:unrecognized_name) unless recognized_server_name?(ch, @crt)
|
154
154
|
|
155
155
|
# alpn
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
@alpn =
|
156
|
+
ch_alpn = ch.extensions[
|
157
|
+
Message::ExtensionType::APPLICATION_LAYER_PROTOCOL_NEGOTIATION
|
158
|
+
]
|
159
|
+
if !@settings[:alpn].nil? && !@settings[:alpn].empty? && !ch_alpn.nil?
|
160
|
+
@alpn = ch_alpn.protocol_name_list
|
161
|
+
.find { |p| @settings[:alpn].include?(p) }
|
161
162
|
|
162
163
|
terminate(:no_application_protocol) if @alpn.nil?
|
163
164
|
end
|
data/lib/tttls1.3/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tttls1.3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
|
-
rubygems_version: 3.0.
|
194
|
+
rubygems_version: 3.0.1
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: TLS 1.3 implementation in Ruby
|