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/client_spec.rb
CHANGED
@@ -9,8 +9,8 @@ RSpec.describe Client do
|
|
9
9
|
let(:record) do
|
10
10
|
mock_socket = SimpleStream.new
|
11
11
|
client = Client.new(mock_socket, 'localhost')
|
12
|
-
|
13
|
-
client.send(:send_client_hello,
|
12
|
+
extensions, _priv_keys = client.send(:gen_ch_extensions)
|
13
|
+
client.send(:send_client_hello, extensions)
|
14
14
|
Record.deserialize(mock_socket.read, Cryptograph::Passer.new)
|
15
15
|
end
|
16
16
|
|
@@ -52,52 +52,51 @@ RSpec.describe Client do
|
|
52
52
|
let(:client) do
|
53
53
|
mock_socket = SimpleStream.new
|
54
54
|
mock_socket.write(TESTBINARY_SERVER_PARAMETERS_RECORD)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
Client.new(mock_socket, 'localhost')
|
56
|
+
end
|
57
|
+
|
58
|
+
let(:cipher) do
|
59
|
+
Cryptograph::Aead.new(
|
60
60
|
cipher_suite: CipherSuite::TLS_AES_128_GCM_SHA256,
|
61
61
|
write_key: TESTBINARY_SERVER_PARAMETERS_WRITE_KEY,
|
62
62
|
write_iv: TESTBINARY_SERVER_PARAMETERS_WRITE_IV,
|
63
|
-
sequence_number:
|
63
|
+
sequence_number: SequenceNumber.new
|
64
64
|
)
|
65
|
-
client.instance_variable_set(:@read_cipher, cipher)
|
66
|
-
client.instance_variable_set(:@read_seq_num, read_seq_num)
|
67
|
-
client
|
68
65
|
end
|
69
66
|
|
70
67
|
it 'should receive EncryptedExtensions' do
|
71
|
-
message = client.send(:recv_encrypted_extensions)
|
68
|
+
message = client.send(:recv_encrypted_extensions, cipher)
|
72
69
|
expect(message.msg_type).to eq HandshakeType::ENCRYPTED_EXTENSIONS
|
73
70
|
end
|
74
71
|
|
75
72
|
it 'should receive Certificate' do
|
76
|
-
client.send(:recv_encrypted_extensions) # to skip
|
77
|
-
message = client.send(:recv_certificate)
|
73
|
+
client.send(:recv_encrypted_extensions, cipher) # to skip
|
74
|
+
message = client.send(:recv_certificate, cipher)
|
78
75
|
expect(message.msg_type).to eq HandshakeType::CERTIFICATE
|
79
76
|
end
|
80
77
|
|
81
78
|
it 'should receive CertificateVerify' do
|
82
|
-
client.send(:recv_encrypted_extensions) # to skip
|
83
|
-
client.send(:recv_certificate) # to skip
|
84
|
-
message = client.send(:recv_certificate_verify)
|
79
|
+
client.send(:recv_encrypted_extensions, cipher) # to skip
|
80
|
+
client.send(:recv_certificate, cipher) # to skip
|
81
|
+
message = client.send(:recv_certificate_verify, cipher)
|
85
82
|
expect(message.msg_type).to eq HandshakeType::CERTIFICATE_VERIFY
|
86
83
|
end
|
87
84
|
|
88
85
|
it 'should receive Finished' do
|
89
|
-
client.send(:recv_encrypted_extensions) # to skip
|
90
|
-
client.send(:recv_certificate) # to skip
|
91
|
-
client.send(:recv_certificate_verify) # to skip
|
92
|
-
message = client.send(:recv_finished)
|
86
|
+
client.send(:recv_encrypted_extensions, cipher) # to skip
|
87
|
+
client.send(:recv_certificate, cipher) # to skip
|
88
|
+
client.send(:recv_certificate_verify, cipher) # to skip
|
89
|
+
message = client.send(:recv_finished, cipher)
|
93
90
|
expect(message.msg_type).to eq HandshakeType::FINISHED
|
94
91
|
end
|
95
92
|
end
|
96
93
|
|
97
94
|
context 'client' do
|
98
|
-
let(:
|
99
|
-
|
100
|
-
|
95
|
+
let(:cipher_suite) do
|
96
|
+
CipherSuite::TLS_AES_128_GCM_SHA256
|
97
|
+
end
|
98
|
+
|
99
|
+
let(:transcript) do
|
101
100
|
transcript = Transcript.new
|
102
101
|
transcript.merge!(
|
103
102
|
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
@@ -107,30 +106,41 @@ RSpec.describe Client do
|
|
107
106
|
CV => CertificateVerify.deserialize(TESTBINARY_CERTIFICATE_VERIFY),
|
108
107
|
SF => Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
109
108
|
)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
109
|
+
transcript
|
110
|
+
end
|
111
|
+
|
112
|
+
let(:finished_key) do
|
113
|
+
key_schedule = KeySchedule.new(
|
114
|
+
shared_secret: TESTBINARY_SHARED_SECRET,
|
115
|
+
cipher_suite: cipher_suite,
|
116
|
+
transcript: transcript
|
117
|
+
)
|
118
|
+
key_schedule.client_finished_key
|
119
|
+
end
|
120
|
+
|
121
|
+
let(:record) do
|
122
|
+
mock_socket = SimpleStream.new
|
123
|
+
client = Client.new(mock_socket, 'localhost')
|
124
|
+
digest = CipherSuite.digest(cipher_suite)
|
125
|
+
hash = transcript.hash(digest, EOED)
|
126
|
+
signature = client.send(:sign_finished,
|
127
|
+
digest: digest,
|
128
|
+
finished_key: finished_key,
|
129
|
+
hash: hash)
|
130
|
+
hs_wcipher = Cryptograph::Aead.new(
|
131
|
+
cipher_suite: cipher_suite,
|
120
132
|
write_key: TESTBINARY_CLIENT_FINISHED_WRITE_KEY,
|
121
133
|
write_iv: TESTBINARY_CLIENT_FINISHED_WRITE_IV,
|
122
|
-
sequence_number:
|
134
|
+
sequence_number: SequenceNumber.new
|
123
135
|
)
|
124
|
-
client.
|
125
|
-
|
126
|
-
|
127
|
-
read_cipher = Cryptograph::Aead.new(
|
128
|
-
cipher_suite: CipherSuite::TLS_AES_128_GCM_SHA256,
|
136
|
+
client.send(:send_finished, signature, hs_wcipher)
|
137
|
+
hs_rcipher = Cryptograph::Aead.new(
|
138
|
+
cipher_suite: cipher_suite,
|
129
139
|
write_key: TESTBINARY_CLIENT_FINISHED_WRITE_KEY,
|
130
140
|
write_iv: TESTBINARY_CLIENT_FINISHED_WRITE_IV,
|
131
141
|
sequence_number: SequenceNumber.new
|
132
142
|
)
|
133
|
-
Record.deserialize(mock_socket.read,
|
143
|
+
Record.deserialize(mock_socket.read, hs_rcipher)
|
134
144
|
end
|
135
145
|
|
136
146
|
it 'should send Finished' do
|
@@ -143,144 +153,73 @@ RSpec.describe Client do
|
|
143
153
|
end
|
144
154
|
|
145
155
|
context 'client' do
|
146
|
-
let(:
|
147
|
-
|
148
|
-
transcript = Transcript.new
|
149
|
-
transcript.merge!(
|
150
|
-
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
151
|
-
SH => ServerHello.deserialize(TESTBINARY_SERVER_HELLO),
|
152
|
-
EE => EncryptedExtensions.deserialize(TESTBINARY_ENCRYPTED_EXTENSIONS),
|
153
|
-
CT => Certificate.deserialize(TESTBINARY_CERTIFICATE),
|
154
|
-
CV => CertificateVerify.deserialize(TESTBINARY_CERTIFICATE_VERIFY),
|
155
|
-
SF => Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
156
|
-
)
|
157
|
-
client.instance_variable_set(:@transcript, transcript)
|
158
|
-
ks = KeySchedule.new(shared_secret: TESTBINARY_SHARED_SECRET,
|
159
|
-
cipher_suite: CipherSuite::TLS_AES_128_GCM_SHA256,
|
160
|
-
transcript: transcript)
|
161
|
-
client.instance_variable_set(:@key_schedule, ks)
|
162
|
-
client.instance_variable_set(:@cipher_suite,
|
163
|
-
CipherSuite::TLS_AES_128_GCM_SHA256)
|
164
|
-
client
|
156
|
+
let(:cipher_suite) do
|
157
|
+
CipherSuite::TLS_AES_128_GCM_SHA256
|
165
158
|
end
|
166
159
|
|
167
|
-
let(:
|
168
|
-
|
160
|
+
let(:ct) do
|
161
|
+
Certificate.deserialize(TESTBINARY_CERTIFICATE)
|
169
162
|
end
|
170
163
|
|
171
|
-
|
172
|
-
|
164
|
+
let(:cv) do
|
165
|
+
CertificateVerify.deserialize(TESTBINARY_CERTIFICATE_VERIFY)
|
173
166
|
end
|
174
167
|
|
175
|
-
|
176
|
-
|
168
|
+
let(:sf) do
|
169
|
+
Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
177
170
|
end
|
178
171
|
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
context 'client' do
|
185
|
-
let(:client) do
|
186
|
-
client = Client.new(nil, 'localhost')
|
187
|
-
transcript = {
|
172
|
+
let(:transcript) do
|
173
|
+
transcript = Transcript.new
|
174
|
+
transcript.merge!(
|
188
175
|
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
189
|
-
SH => ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
it 'should check that ServerHello.legacy_version matches ' \
|
196
|
-
'ClientHello.legacy_version' do
|
197
|
-
expect(client.send(:valid_sh_legacy_version?)).to be true
|
198
|
-
end
|
199
|
-
|
200
|
-
it 'should check that ServerHello.legacy_session_id_echo matches ' \
|
201
|
-
'ClientHello.legacy_session_id' do
|
202
|
-
expect(client.send(:valid_sh_legacy_session_id_echo?)).to be true
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'should check that ServerHello.cipher_suite is included in' \
|
206
|
-
'ClientHello.cipher_suites' do
|
207
|
-
expect(client.send(:valid_sh_cipher_suite?)).to be true
|
208
|
-
end
|
209
|
-
|
210
|
-
it 'should check that ServerHello.compression_method is valid value' do
|
211
|
-
expect(client.send(:valid_sh_compression_method?)).to be true
|
176
|
+
SH => ServerHello.deserialize(TESTBINARY_SERVER_HELLO),
|
177
|
+
EE => EncryptedExtensions.deserialize(TESTBINARY_ENCRYPTED_EXTENSIONS),
|
178
|
+
CT => ct,
|
179
|
+
CV => cv,
|
180
|
+
SF => sf
|
181
|
+
)
|
212
182
|
end
|
213
183
|
|
214
|
-
|
215
|
-
|
184
|
+
let(:key_schedule) do
|
185
|
+
KeySchedule.new(
|
186
|
+
shared_secret: TESTBINARY_SHARED_SECRET,
|
187
|
+
cipher_suite: cipher_suite,
|
188
|
+
transcript: transcript
|
189
|
+
)
|
216
190
|
end
|
217
|
-
end
|
218
191
|
|
219
|
-
context 'client, received ServerHello with random[-8..] == ' \
|
220
|
-
'downgrade protection value(TLS 1.2),' do
|
221
192
|
let(:client) do
|
222
|
-
|
223
|
-
client = Client.new(mock_socket, 'localhost')
|
224
|
-
sh = ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
225
|
-
random = OpenSSL::Random.random_bytes(24) + \
|
226
|
-
Client.const_get(:DOWNGRADE_PROTECTION_TLS_1_2)
|
227
|
-
sh.instance_variable_set(:@random, random)
|
228
|
-
transcript = {
|
229
|
-
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
230
|
-
SH => sh
|
231
|
-
}
|
232
|
-
client.instance_variable_set(:@transcript, transcript)
|
233
|
-
client
|
234
|
-
end
|
235
|
-
|
236
|
-
it 'should check downgrade protection value' do
|
237
|
-
expect(client.send(:valid_sh_random?)).to be false
|
238
|
-
expect(client.send(:negotiated_tls_1_3?)).to be true
|
193
|
+
Client.new(nil, 'localhost')
|
239
194
|
end
|
240
|
-
end
|
241
195
|
|
242
|
-
|
243
|
-
|
244
|
-
let(:client) do
|
245
|
-
mock_socket = SimpleStream.new
|
246
|
-
client = Client.new(mock_socket, 'localhost')
|
247
|
-
sh = ServerHello.deserialize(TESTBINARY_SERVER_HELLO)
|
248
|
-
random = OpenSSL::Random.random_bytes(24) + \
|
249
|
-
Client.const_get(:DOWNGRADE_PROTECTION_TLS_1_1)
|
250
|
-
sh.instance_variable_set(:@random, random)
|
251
|
-
transcript = {
|
252
|
-
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
253
|
-
SH => sh
|
254
|
-
}
|
255
|
-
client.instance_variable_set(:@transcript, transcript)
|
256
|
-
client
|
196
|
+
let(:cf) do
|
197
|
+
Finished.deserialize(TESTBINARY_CLIENT_FINISHED)
|
257
198
|
end
|
258
199
|
|
259
|
-
it 'should
|
260
|
-
|
261
|
-
expect(client.send(:
|
200
|
+
it 'should verify server CertificateVerify' do
|
201
|
+
hash = transcript.hash(CipherSuite.digest(cipher_suite), CT)
|
202
|
+
expect(client.send(:verified_certificate_verify?, ct, cv, hash))
|
203
|
+
.to be true
|
262
204
|
end
|
263
|
-
end
|
264
205
|
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
sh.instance_variable_set(:@extensions, extensions)
|
274
|
-
transcript = {
|
275
|
-
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
276
|
-
SH => sh
|
277
|
-
}
|
278
|
-
client.instance_variable_set(:@transcript, transcript)
|
279
|
-
client
|
206
|
+
it 'should verify server Finished' do
|
207
|
+
digest = CipherSuite.digest(cipher_suite)
|
208
|
+
hash = transcript.hash(digest, CV)
|
209
|
+
expect(client.send(:verified_finished?,
|
210
|
+
finished: sf,
|
211
|
+
digest: digest,
|
212
|
+
finished_key: key_schedule.server_finished_key,
|
213
|
+
hash: hash)).to be true
|
280
214
|
end
|
281
215
|
|
282
|
-
it 'should
|
283
|
-
|
216
|
+
it 'should sign client Finished' do
|
217
|
+
digest = CipherSuite.digest(cipher_suite)
|
218
|
+
hash = transcript.hash(digest, EOED)
|
219
|
+
expect(client.send(:sign_finished,
|
220
|
+
digest: digest,
|
221
|
+
finished_key: key_schedule.client_finished_key,
|
222
|
+
hash: hash)).to eq cf.verify_data
|
284
223
|
end
|
285
224
|
end
|
286
225
|
|
data/spec/connection_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require_relative 'spec_helper'
|
|
5
5
|
|
6
6
|
RSpec.describe Connection do
|
7
7
|
context 'connection, Simple 1-RTT Handshake,' do
|
8
|
-
let(:
|
8
|
+
let(:key) do
|
9
9
|
rsa = OpenSSL::PKey::RSA.new
|
10
10
|
rsa.set_key(OpenSSL::BN.new(TESTBINARY_PKEY_MODULUS, 2),
|
11
11
|
OpenSSL::BN.new(TESTBINARY_PKEY_PUBLIC_EXPONENT, 2),
|
@@ -31,8 +31,7 @@ RSpec.describe Connection do
|
|
31
31
|
Finished.deserialize(TESTBINARY_SERVER_FINISHED)
|
32
32
|
end
|
33
33
|
|
34
|
-
let(:
|
35
|
-
connection = Connection.new(nil)
|
34
|
+
let(:transcript) do
|
36
35
|
transcript = Transcript.new
|
37
36
|
transcript.merge!(
|
38
37
|
CH => ClientHello.deserialize(TESTBINARY_CLIENT_HELLO),
|
@@ -43,39 +42,44 @@ RSpec.describe Connection do
|
|
43
42
|
CF => cf,
|
44
43
|
SF => sf
|
45
44
|
)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:digest) do
|
48
|
+
CipherSuite.digest(CipherSuite::TLS_AES_128_GCM_SHA256)
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:connection) do
|
52
|
+
Connection.new(nil)
|
50
53
|
end
|
51
54
|
|
52
55
|
it 'should verify server CertificateVerify.signature' do
|
53
56
|
public_key = ct.certificate_list.first.cert_data.public_key
|
54
57
|
signature_scheme = cv.signature_scheme
|
55
58
|
signature = cv.signature
|
59
|
+
|
56
60
|
expect(connection.send(:do_verified_certificate_verify?,
|
57
61
|
public_key: public_key,
|
58
62
|
signature_scheme: signature_scheme,
|
59
63
|
signature: signature,
|
60
64
|
context: 'TLS 1.3, server CertificateVerify',
|
61
|
-
|
65
|
+
hash: transcript.hash(digest, CT)))
|
62
66
|
.to be true
|
63
67
|
end
|
64
68
|
|
65
69
|
it 'should sign client Finished.verify_data' do
|
66
|
-
expect(connection.send(:
|
70
|
+
expect(connection.send(:sign_finished,
|
67
71
|
digest: 'SHA256',
|
68
72
|
finished_key: TESTBINARY_CLIENT_FINISHED_KEY,
|
69
|
-
|
73
|
+
hash: transcript.hash(digest, EOED)))
|
70
74
|
.to eq cf.verify_data
|
71
75
|
end
|
72
76
|
|
73
77
|
it 'should verify server Finished.verify_data' do
|
74
|
-
expect(connection.send(:
|
78
|
+
expect(connection.send(:verified_finished?,
|
79
|
+
finished: sf,
|
75
80
|
digest: 'SHA256',
|
76
81
|
finished_key: TESTBINARY_SERVER_FINISHED_KEY,
|
77
|
-
|
78
|
-
signature: sf.verify_data))
|
82
|
+
hash: transcript.hash(digest, CV)))
|
79
83
|
.to be true
|
80
84
|
end
|
81
85
|
|
@@ -86,16 +90,17 @@ RSpec.describe Connection do
|
|
86
90
|
# used RSASSA-PSS signature_scheme, salt is a random sequence.
|
87
91
|
# CertificateVerify.signature is random.
|
88
92
|
signature = connection.send(:do_sign_certificate_verify,
|
89
|
-
|
93
|
+
key: key,
|
90
94
|
signature_scheme: signature_scheme,
|
91
95
|
context: 'TLS 1.3, server CertificateVerify',
|
92
|
-
|
96
|
+
hash: transcript.hash(digest, CT))
|
97
|
+
|
93
98
|
expect(connection.send(:do_verified_certificate_verify?,
|
94
99
|
public_key: public_key,
|
95
100
|
signature_scheme: signature_scheme,
|
96
101
|
signature: signature,
|
97
102
|
context: 'TLS 1.3, server CertificateVerify',
|
98
|
-
|
103
|
+
hash: transcript.hash(digest, CT)))
|
99
104
|
.to be true
|
100
105
|
end
|
101
106
|
end
|
@@ -109,8 +114,7 @@ RSpec.describe Connection do
|
|
109
114
|
CertificateVerify.deserialize(TESTBINARY_HRR_CERTIFICATE_VERIFY)
|
110
115
|
end
|
111
116
|
|
112
|
-
let(:
|
113
|
-
connection = Connection.new(nil)
|
117
|
+
let(:transcript) do
|
114
118
|
transcript = Transcript.new
|
115
119
|
transcript.merge!(
|
116
120
|
CH1 => ClientHello.deserialize(TESTBINARY_HRR_CLIENT_HELLO1),
|
@@ -122,22 +126,27 @@ RSpec.describe Connection do
|
|
122
126
|
CT => ct,
|
123
127
|
CV => cv
|
124
128
|
)
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
+
end
|
130
|
+
|
131
|
+
let(:digest) do
|
132
|
+
CipherSuite.digest(CipherSuite::TLS_AES_128_GCM_SHA256)
|
133
|
+
end
|
134
|
+
|
135
|
+
let(:connection) do
|
136
|
+
Connection.new(nil)
|
129
137
|
end
|
130
138
|
|
131
139
|
it 'should verify server CertificateVerify.signature' do
|
132
140
|
public_key = ct.certificate_list.first.cert_data.public_key
|
133
141
|
signature_scheme = cv.signature_scheme
|
134
142
|
signature = cv.signature
|
143
|
+
|
135
144
|
expect(connection.send(:do_verified_certificate_verify?,
|
136
145
|
public_key: public_key,
|
137
146
|
signature_scheme: signature_scheme,
|
138
147
|
signature: signature,
|
139
148
|
context: 'TLS 1.3, server CertificateVerify',
|
140
|
-
|
149
|
+
hash: transcript.hash(digest, CT)))
|
141
150
|
.to be true
|
142
151
|
end
|
143
152
|
end
|
@@ -31,7 +31,7 @@ RSpec.describe EncryptedExtensions do
|
|
31
31
|
it 'should be generated' do
|
32
32
|
expect(message.msg_type).to eq HandshakeType::ENCRYPTED_EXTENSIONS
|
33
33
|
expect(message.extensions).to eq extensions
|
34
|
-
expect(message.
|
34
|
+
expect(message.appearable_extensions?).to be true
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'should be serialized' do
|
@@ -55,7 +55,7 @@ RSpec.describe EncryptedExtensions do
|
|
55
55
|
it 'should be generated' do
|
56
56
|
expect(message.msg_type).to eq HandshakeType::ENCRYPTED_EXTENSIONS
|
57
57
|
expect(message.extensions).to eq extensions
|
58
|
-
expect(message.
|
58
|
+
expect(message.appearable_extensions?).to be false
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -67,7 +67,7 @@ RSpec.describe EncryptedExtensions do
|
|
67
67
|
it 'should be generated' do
|
68
68
|
expect(message.msg_type).to eq HandshakeType::ENCRYPTED_EXTENSIONS
|
69
69
|
expect(message.extensions).to eq Extensions.new
|
70
|
-
expect(message.
|
70
|
+
expect(message.appearable_extensions?).to be true
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should be serialized' do
|
@@ -84,7 +84,7 @@ RSpec.describe EncryptedExtensions do
|
|
84
84
|
|
85
85
|
it 'should generate valid object' do
|
86
86
|
expect(message.msg_type).to eq HandshakeType::ENCRYPTED_EXTENSIONS
|
87
|
-
expect(message.
|
87
|
+
expect(message.appearable_extensions?).to be true
|
88
88
|
end
|
89
89
|
|
90
90
|
it 'should generate valid serializable object' do
|
data/spec/fixtures/rsa_ca.crt
CHANGED
@@ -1,29 +1,18 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
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