tttls1.3 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/Rakefile +3 -3
- data/example/https_client_using_hrr_and_ticket.rb +40 -0
- data/interop/client_spec.rb +15 -0
- data/interop/server_spec.rb +8 -0
- data/lib/tttls1.3/client.rb +265 -272
- data/lib/tttls1.3/connection.rb +85 -62
- data/lib/tttls1.3/message/certificate.rb +1 -1
- data/lib/tttls1.3/message/client_hello.rb +26 -1
- data/lib/tttls1.3/message/encrypted_extensions.rb +1 -1
- data/lib/tttls1.3/message/new_session_ticket.rb +1 -1
- data/lib/tttls1.3/message/server_hello.rb +21 -1
- data/lib/tttls1.3/server.rb +179 -157
- data/lib/tttls1.3/version.rb +1 -1
- data/spec/certificate_spec.rb +4 -4
- data/spec/client_hello_spec.rb +3 -0
- data/spec/client_spec.rb +96 -157
- data/spec/connection_spec.rb +32 -23
- data/spec/encrypted_extensions_spec.rb +4 -4
- data/spec/fixtures/rsa_ca.crt +16 -27
- data/spec/fixtures/rsa_ca.key +25 -49
- data/spec/fixtures/rsa_rsa.crt +16 -21
- data/spec/fixtures/rsa_rsa.key +25 -25
- data/spec/fixtures/rsa_rsassaPss.crt +20 -0
- data/spec/fixtures/rsa_rsassaPss.key +27 -0
- data/spec/fixtures/rsa_secp256r1.crt +12 -17
- data/spec/fixtures/rsa_secp256r1.key +3 -3
- data/spec/fixtures/rsa_secp384r1.crt +12 -17
- data/spec/fixtures/rsa_secp384r1.key +4 -4
- data/spec/fixtures/rsa_secp521r1.crt +13 -18
- data/spec/fixtures/rsa_secp521r1.key +5 -5
- data/spec/server_hello_spec.rb +60 -0
- data/spec/server_spec.rb +79 -60
- metadata +7 -2
data/spec/fixtures/rsa_rsa.crt
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
MIHcAgEBBEIBpLFBw5Z/X6SoBwA8uOZczz8UB3uiQv2LpVhIp4GFOyRJKx5x3YL7
|
3
|
+
jrx2zaaIdaGFi82tJ8UEAcdEknCXkWFhKfKgBwYFK4EEACOhgYkDgYYABAA2hmEd
|
4
|
+
+V4JM974u/DSPW7uGafw5mF9XngzGU2HeIhY4vXDzt884Rt4kjpcAByAjxtbVhB9
|
5
|
+
byPwc5FN6LrZiatB+gBDIija5Fq6d1gn3nXESirdZrMyLAlykXhS7nywOx0HDCYq
|
6
|
+
2sD0lIMZXB04kFVC+XQsLqwA5J1k87oQ3EwEjwJVzA==
|
7
7
|
-----END EC PRIVATE KEY-----
|
data/spec/server_hello_spec.rb
CHANGED
@@ -32,6 +32,9 @@ RSpec.describe ServerHello do
|
|
32
32
|
expect(message.cipher_suite).to eq CipherSuite::TLS_AES_256_GCM_SHA384
|
33
33
|
expect(message.legacy_compression_method).to eq "\x00"
|
34
34
|
expect(message.extensions).to be_empty
|
35
|
+
expect(message.hrr?).to be false
|
36
|
+
expect(message.appearable_extensions?).to be true
|
37
|
+
expect(message.negotiated_tls_1_3?).to be false
|
35
38
|
end
|
36
39
|
|
37
40
|
it 'should be serialized' do
|
@@ -57,6 +60,9 @@ RSpec.describe ServerHello do
|
|
57
60
|
expect(message.legacy_version).to eq ProtocolVersion::TLS_1_2
|
58
61
|
expect(message.cipher_suite).to eq CipherSuite::TLS_AES_128_GCM_SHA256
|
59
62
|
expect(message.legacy_compression_method).to eq "\x00"
|
63
|
+
expect(message.hrr?).to be false
|
64
|
+
expect(message.appearable_extensions?).to be true
|
65
|
+
expect(message.negotiated_tls_1_3?).to be true
|
60
66
|
end
|
61
67
|
|
62
68
|
it 'should generate valid serializable object' do
|
@@ -75,6 +81,8 @@ RSpec.describe ServerHello do
|
|
75
81
|
expect(message.cipher_suite).to eq CipherSuite::TLS_AES_128_GCM_SHA256
|
76
82
|
expect(message.legacy_compression_method).to eq "\x00"
|
77
83
|
expect(message.hrr?).to be true
|
84
|
+
expect(message.appearable_extensions?).to be true
|
85
|
+
expect(message.negotiated_tls_1_3?).to be true
|
78
86
|
end
|
79
87
|
|
80
88
|
it 'should generate valid serializable object' do
|
@@ -92,6 +100,9 @@ RSpec.describe ServerHello do
|
|
92
100
|
expect(message.legacy_version).to eq ProtocolVersion::TLS_1_2
|
93
101
|
expect(message.cipher_suite).to eq CipherSuite::TLS_AES_128_GCM_SHA256
|
94
102
|
expect(message.legacy_compression_method).to eq "\x00"
|
103
|
+
expect(message.hrr?).to be false
|
104
|
+
expect(message.appearable_extensions?).to be true
|
105
|
+
expect(message.negotiated_tls_1_3?).to be true
|
95
106
|
end
|
96
107
|
|
97
108
|
it 'should generate valid serializable object' do
|
@@ -123,6 +134,8 @@ RSpec.describe ServerHello do
|
|
123
134
|
expect(message.legacy_compression_method).to eq "\x00"
|
124
135
|
expect(message.extensions).to be_empty
|
125
136
|
expect(message.hrr?).to eq true
|
137
|
+
expect(message.appearable_extensions?).to be true
|
138
|
+
expect(message.negotiated_tls_1_3?).to be false
|
126
139
|
end
|
127
140
|
|
128
141
|
it 'should be serialized' do
|
@@ -137,4 +150,51 @@ RSpec.describe ServerHello do
|
|
137
150
|
+ Extensions.new.serialize
|
138
151
|
end
|
139
152
|
end
|
153
|
+
|
154
|
+
context 'server_hello with random[-8..] == downgrade protection ' \
|
155
|
+
'value(TLS 1.2)' do
|
156
|
+
let(:message) do
|
157
|
+
sh = ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
158
|
+
random = OpenSSL::Random.random_bytes(24) + \
|
159
|
+
ServerHello.const_get(:DOWNGRADE_PROTECTION_TLS_1_2)
|
160
|
+
sh.instance_variable_set(:@random, random)
|
161
|
+
sh
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'should check downgrade protection value' do
|
165
|
+
expect(message.negotiated_tls_1_3?).to be true
|
166
|
+
expect(message.downgraded?).to be true
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'server_hello with random[-8..] == downgrade protection ' \
|
171
|
+
'value(TLS 1.2)' do
|
172
|
+
let(:message) do
|
173
|
+
sh = ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
174
|
+
random = OpenSSL::Random.random_bytes(24) + \
|
175
|
+
ServerHello.const_get(:DOWNGRADE_PROTECTION_TLS_1_1)
|
176
|
+
sh.instance_variable_set(:@random, random)
|
177
|
+
sh
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'should check downgrade protection value' do
|
181
|
+
expect(message.negotiated_tls_1_3?).to be true
|
182
|
+
expect(message.downgraded?).to be true
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
context 'server_hello with supported_versions not including "\x03\x04"' do
|
187
|
+
let(:message) do
|
188
|
+
sh = ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
189
|
+
extensions = sh.instance_variable_get(:@extensions)
|
190
|
+
extensions[ExtensionType::SUPPORTED_VERSIONS] = nil
|
191
|
+
sh.instance_variable_set(:@extensions, extensions)
|
192
|
+
sh
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should check downgrade protection value' do
|
196
|
+
expect(message.negotiated_tls_1_3?).to be false
|
197
|
+
expect(message.downgraded?).to be false
|
198
|
+
end
|
199
|
+
end
|
140
200
|
end
|
data/spec/server_spec.rb
CHANGED
@@ -14,7 +14,7 @@ RSpec.describe Server do
|
|
14
14
|
+ msg_len.to_uint16 \
|
15
15
|
+ TESTBINARY_CLIENT_HELLO)
|
16
16
|
server = Server.new(mock_socket)
|
17
|
-
server.send(:recv_client_hello)
|
17
|
+
server.send(:recv_client_hello, true)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should receive ClientHello' do
|
@@ -31,45 +31,47 @@ RSpec.describe Server do
|
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
34
|
-
let(:
|
35
|
-
|
36
|
-
|
37
|
-
server.instance_variable_set(:@crt, crt)
|
38
|
-
transcript = Transcript.new
|
39
|
-
transcript[CH] = ClientHello.deserialize(TESTBINARY_CLIENT_HELLO)
|
40
|
-
server.instance_variable_set(:@transcript, transcript)
|
41
|
-
cipher_suite = server.send(:select_cipher_suite)
|
42
|
-
server.instance_variable_set(:@cipher_suite, cipher_suite)
|
34
|
+
let(:ch) do
|
35
|
+
ch = ClientHello.deserialize(TESTBINARY_CLIENT_HELLO)
|
36
|
+
|
43
37
|
# X25519 is unsupported so @named_group uses SECP256R1.
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
38
|
+
key_share = KeyShare.new(
|
39
|
+
msg_type: HandshakeType::CLIENT_HELLO,
|
40
|
+
key_share_entry: [
|
41
|
+
KeyShareEntry.new(
|
42
|
+
group: NamedGroup::SECP256R1,
|
43
|
+
key_exchange: "\x04" + OpenSSL::Random.random_bytes(64)
|
44
|
+
)
|
45
|
+
]
|
46
|
+
)
|
47
|
+
ch.extensions[ExtensionType::KEY_SHARE] = key_share
|
48
|
+
ch
|
50
49
|
end
|
51
50
|
|
52
|
-
|
53
|
-
|
51
|
+
let(:server) do
|
52
|
+
Server.new(nil)
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
expect(
|
57
|
-
|
58
|
-
expect(
|
55
|
+
it 'should select parameters' do
|
56
|
+
expect(server.send(:select_cipher_suite, ch))
|
57
|
+
.to eq CipherSuite::TLS_AES_128_GCM_SHA256
|
58
|
+
expect(server.send(:select_named_group, ch)).to eq NamedGroup::SECP256R1
|
59
|
+
expect(server.send(:select_signature_scheme, ch, crt))
|
60
|
+
.to eq SignatureScheme::RSA_PSS_RSAE_SHA256
|
59
61
|
end
|
60
62
|
end
|
61
63
|
|
62
64
|
context 'server' do
|
65
|
+
let(:ch) do
|
66
|
+
ClientHello.deserialize(TESTBINARY_CLIENT_HELLO)
|
67
|
+
end
|
68
|
+
|
63
69
|
let(:server) do
|
64
|
-
|
65
|
-
transcript = Transcript.new
|
66
|
-
transcript[CH] = ClientHello.deserialize(TESTBINARY_CLIENT_HELLO)
|
67
|
-
server.instance_variable_set(:@transcript, transcript)
|
68
|
-
server
|
70
|
+
Server.new(nil)
|
69
71
|
end
|
70
72
|
|
71
73
|
it 'should generate EncryptedExtensions' do
|
72
|
-
ee = server.send(:gen_encrypted_extensions)
|
74
|
+
ee = server.send(:gen_encrypted_extensions, ch)
|
73
75
|
expect(ee).to be_a_kind_of(EncryptedExtensions)
|
74
76
|
expect(ee.extensions).to include(ExtensionType::SERVER_NAME)
|
75
77
|
expect(ee.extensions[ExtensionType::SERVER_NAME].server_name).to eq ''
|
@@ -82,17 +84,18 @@ RSpec.describe Server do
|
|
82
84
|
end
|
83
85
|
|
84
86
|
context 'server' do
|
85
|
-
let(:
|
86
|
-
|
87
|
-
crt = OpenSSL::X509::Certificate.new(
|
87
|
+
let(:crt) do
|
88
|
+
OpenSSL::X509::Certificate.new(
|
88
89
|
File.read(__dir__ + '/fixtures/rsa_rsa.crt')
|
89
90
|
)
|
90
|
-
|
91
|
-
|
91
|
+
end
|
92
|
+
|
93
|
+
let(:server) do
|
94
|
+
Server.new(nil)
|
92
95
|
end
|
93
96
|
|
94
97
|
it 'should generate Certificate' do
|
95
|
-
ct = server.send(:gen_certificate)
|
98
|
+
ct = server.send(:gen_certificate, crt)
|
96
99
|
expect(ct).to be_a_kind_of(Certificate)
|
97
100
|
|
98
101
|
certificate_entry = ct.certificate_list.first
|
@@ -115,9 +118,7 @@ RSpec.describe Server do
|
|
115
118
|
Certificate.deserialize(TESTBINARY_CERTIFICATE)
|
116
119
|
end
|
117
120
|
|
118
|
-
let(:
|
119
|
-
server = Server.new(nil)
|
120
|
-
server.instance_variable_set(:@key, key)
|
121
|
+
let(:transcript) do
|
121
122
|
transcript = Transcript.new
|
122
123
|
transcript.merge!(
|
123
124
|
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
@@ -125,16 +126,24 @@ RSpec.describe Server do
|
|
125
126
|
EE => EncryptedExtensions.deserialize(TESTBINARY_ENCRYPTED_EXTENSIONS),
|
126
127
|
CT => ct
|
127
128
|
)
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
129
|
+
end
|
130
|
+
|
131
|
+
let(:cipher_suite) do
|
132
|
+
CipherSuite::TLS_AES_128_GCM_SHA256
|
133
|
+
end
|
134
|
+
|
135
|
+
let(:signature_scheme) do
|
136
|
+
SignatureScheme::RSA_PSS_RSAE_SHA256
|
137
|
+
end
|
138
|
+
|
139
|
+
let(:server) do
|
140
|
+
Server.new(nil)
|
134
141
|
end
|
135
142
|
|
136
143
|
it 'should generate CertificateVerify' do
|
137
|
-
|
144
|
+
digest = CipherSuite.digest(cipher_suite)
|
145
|
+
hash = transcript.hash(digest, CT)
|
146
|
+
cv = server.send(:gen_certificate_verify, key, signature_scheme, hash)
|
138
147
|
expect(cv).to be_a_kind_of(CertificateVerify)
|
139
148
|
|
140
149
|
# used RSASSA-PSS signature_scheme, salt is a random sequence.
|
@@ -142,19 +151,23 @@ RSpec.describe Server do
|
|
142
151
|
public_key = ct.certificate_list.first.cert_data.public_key
|
143
152
|
signature_scheme = cv.signature_scheme
|
144
153
|
signature = cv.signature
|
154
|
+
digest = CipherSuite.digest(cipher_suite)
|
145
155
|
expect(server.send(:do_verified_certificate_verify?,
|
146
156
|
public_key: public_key,
|
147
157
|
signature_scheme: signature_scheme,
|
148
158
|
signature: signature,
|
149
159
|
context: 'TLS 1.3, server CertificateVerify',
|
150
|
-
|
160
|
+
hash: transcript.hash(digest, CT)))
|
151
161
|
.to be true
|
152
162
|
end
|
153
163
|
end
|
154
164
|
|
155
165
|
context 'server' do
|
156
|
-
let(:
|
157
|
-
|
166
|
+
let(:cipher_suite) do
|
167
|
+
CipherSuite::TLS_AES_128_GCM_SHA256
|
168
|
+
end
|
169
|
+
|
170
|
+
let(:transcript) do
|
158
171
|
transcript = Transcript.new
|
159
172
|
transcript.merge!(
|
160
173
|
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
@@ -163,24 +176,30 @@ RSpec.describe Server do
|
|
163
176
|
CT => Certificate.deserialize(TESTBINARY_CERTIFICATE),
|
164
177
|
CV => CertificateVerify.deserialize(TESTBINARY_CERTIFICATE_VERIFY)
|
165
178
|
)
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
179
|
+
transcript
|
180
|
+
end
|
181
|
+
|
182
|
+
let(:key_schedule) do
|
183
|
+
KeySchedule.new(shared_secret: TESTBINARY_SHARED_SECRET,
|
184
|
+
cipher_suite: cipher_suite,
|
185
|
+
transcript: transcript)
|
186
|
+
end
|
187
|
+
|
188
|
+
let(:signature) do
|
189
|
+
server = Server.new(nil)
|
190
|
+
digest = CipherSuite.digest(cipher_suite)
|
191
|
+
server.send(:sign_finished,
|
192
|
+
digest: digest,
|
193
|
+
finished_key: key_schedule.server_finished_key,
|
194
|
+
hash: transcript.hash(digest, CV))
|
174
195
|
end
|
175
196
|
|
176
|
-
let(:
|
177
|
-
Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
197
|
+
let(:sf) do
|
198
|
+
Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
178
199
|
end
|
179
200
|
|
180
201
|
it 'should generate Finished' do
|
181
|
-
|
182
|
-
expect(sf).to be_a_kind_of(Finished)
|
183
|
-
expect(sf.verify_data).to eq verify_data
|
202
|
+
expect(signature).to eq sf.verify_data
|
184
203
|
end
|
185
204
|
end
|
186
205
|
end
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- example/https_client.rb
|
72
72
|
- example/https_client_using_0rtt.rb
|
73
73
|
- example/https_client_using_hrr.rb
|
74
|
+
- example/https_client_using_hrr_and_ticket.rb
|
74
75
|
- example/https_client_using_ticket.rb
|
75
76
|
- example/https_server.rb
|
76
77
|
- interop/Dockerfile
|
@@ -143,6 +144,8 @@ files:
|
|
143
144
|
- spec/fixtures/rsa_ca.key
|
144
145
|
- spec/fixtures/rsa_rsa.crt
|
145
146
|
- spec/fixtures/rsa_rsa.key
|
147
|
+
- spec/fixtures/rsa_rsassaPss.crt
|
148
|
+
- spec/fixtures/rsa_rsassaPss.key
|
146
149
|
- spec/fixtures/rsa_secp256r1.crt
|
147
150
|
- spec/fixtures/rsa_secp256r1.key
|
148
151
|
- spec/fixtures/rsa_secp384r1.crt
|
@@ -214,6 +217,8 @@ test_files:
|
|
214
217
|
- spec/fixtures/rsa_ca.key
|
215
218
|
- spec/fixtures/rsa_rsa.crt
|
216
219
|
- spec/fixtures/rsa_rsa.key
|
220
|
+
- spec/fixtures/rsa_rsassaPss.crt
|
221
|
+
- spec/fixtures/rsa_rsassaPss.key
|
217
222
|
- spec/fixtures/rsa_secp256r1.crt
|
218
223
|
- spec/fixtures/rsa_secp256r1.key
|
219
224
|
- spec/fixtures/rsa_secp384r1.crt
|