tttls1.3 0.2.18 → 0.2.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +8 -5
- data/README.md +2 -2
- data/example/https_client_using_0rtt.rb +1 -1
- data/example/https_client_using_hrr_and_ticket.rb +1 -1
- data/example/https_client_using_ticket.rb +1 -1
- data/interop/client_spec.rb +3 -2
- data/interop/server_spec.rb +1 -3
- data/interop/{helper.rb → spec_helper.rb} +12 -5
- data/lib/tttls1.3/client.rb +19 -8
- data/lib/tttls1.3/connection.rb +6 -8
- data/lib/tttls1.3/key_schedule.rb +40 -5
- data/lib/tttls1.3/message/extension/key_share.rb +2 -4
- data/lib/tttls1.3/server.rb +1 -1
- data/lib/tttls1.3/version.rb +1 -1
- data/spec/connection_spec.rb +22 -7
- data/spec/extensions_spec.rb +1 -2
- data/spec/key_schedule_spec.rb +2 -2
- data/spec/server_spec.rb +22 -7
- 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: 60aaa0dddc8e01d6ee1c89a81de02e7cd9e05e0169e11381ebb68aa919644f11
|
4
|
+
data.tar.gz: 974b5c89009c2a63a6d99a608b32463cb0b6dc4bb0ed9e915cd03cca45ce2ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9ab939f9010481de463c2fbf81dc230cdd653dac47286e1fd61f8820da796a09b0675837dc119ebd8f1ddd137383ccc87aec18edd4945312cb0923ebbe77e52
|
7
|
+
data.tar.gz: 74d0635bba0274cfaf9ed980d2f0cef3351ab1f820a17720424dececaeb86c6ea36d6f9c3d7b69c8e81b52c4790b1796ba59d02a95a30d4afe90bad35767d442
|
data/.github/workflows/ci.yml
CHANGED
@@ -27,8 +27,11 @@ jobs:
|
|
27
27
|
gem install bundler
|
28
28
|
bundle --version
|
29
29
|
bundle install
|
30
|
-
- name: Run
|
31
|
-
run:
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
- name: Run rubocop
|
31
|
+
run: bundle exec rake rubocop
|
32
|
+
- name: Run rspec
|
33
|
+
run: bundle exec rake spec
|
34
|
+
- name: Run interop client
|
35
|
+
run: bundle exec rake interop:client
|
36
|
+
- name: Run interop server
|
37
|
+
run: bundle exec rake interop:server
|
data/README.md
CHANGED
@@ -92,9 +92,9 @@ tttls1.3 client is configurable using keyword arguments.
|
|
92
92
|
| `:supported_groups` | Array of TTTLS13::NamedGroup constant | `SECP256R1`, `SECP384R1`, `SECP521R1` | List of named groups offered in ClientHello extensions. |
|
93
93
|
| `:key_share_groups` | Array of TTTLS13::NamedGroup constant | nil | List of named groups offered in KeyShareClientHello. In default, KeyShareClientHello has only a KeyShareEntry of most preferred named group in `:supported_groups`. You can set this to send KeyShareClientHello that has multiple KeyShareEntry. |
|
94
94
|
| `:alpn` | Array of String | nil | List of application protocols offered in ClientHello extensions. If not needed to be present, set nil. |
|
95
|
-
| `:process_new_session_ticket` | Proc | nil | Proc that processes received NewSessionTicket. Its 3 arguments are TTTLS13::Message::NewSessionTicket, resumption
|
95
|
+
| `:process_new_session_ticket` | Proc | nil | Proc that processes received NewSessionTicket. Its 3 arguments are TTTLS13::Message::NewSessionTicket, resumption main secret and cipher suite. If not needed to process NewSessionTicket, set nil. |
|
96
96
|
| `:ticket` | String | nil | The ticket for PSK. |
|
97
|
-
| `:
|
97
|
+
| `:resumption_secret` | String | nil | The resumption main secret. |
|
98
98
|
| `:psk_cipher_suite` | TTTLS13::CipherSuite constant | nil | The cipher suite for PSK. |
|
99
99
|
| `:ticket_nonce` | String | nil | The ticket\_nonce for PSK. |
|
100
100
|
| `:ticket_age_add` | String | nil | The ticket\_age\_add for PSK. |
|
@@ -15,7 +15,7 @@ process_new_session_ticket = lambda do |nst, rms, cs|
|
|
15
15
|
return if Time.now.to_i - nst.timestamp > nst.ticket_lifetime
|
16
16
|
|
17
17
|
settings_2nd[:ticket] = nst.ticket
|
18
|
-
settings_2nd[:
|
18
|
+
settings_2nd[:resumption_main_secret] = rms
|
19
19
|
settings_2nd[:psk_cipher_suite] = cs
|
20
20
|
settings_2nd[:ticket_nonce] = nst.ticket_nonce
|
21
21
|
settings_2nd[:ticket_age_add] = nst.ticket_age_add
|
@@ -16,7 +16,7 @@ process_new_session_ticket = lambda do |nst, rms, cs|
|
|
16
16
|
|
17
17
|
settings_2nd[:key_share_groups] = [] # empty KeyShareClientHello.client_shares
|
18
18
|
settings_2nd[:ticket] = nst.ticket
|
19
|
-
settings_2nd[:
|
19
|
+
settings_2nd[:resumption_main_secret] = rms
|
20
20
|
settings_2nd[:psk_cipher_suite] = cs
|
21
21
|
settings_2nd[:ticket_nonce] = nst.ticket_nonce
|
22
22
|
settings_2nd[:ticket_age_add] = nst.ticket_age_add
|
@@ -15,7 +15,7 @@ process_new_session_ticket = lambda do |nst, rms, cs|
|
|
15
15
|
return if Time.now.to_i - nst.timestamp > nst.ticket_lifetime
|
16
16
|
|
17
17
|
settings_2nd[:ticket] = nst.ticket
|
18
|
-
settings_2nd[:
|
18
|
+
settings_2nd[:resumption_main_secret] = rms
|
19
19
|
settings_2nd[:psk_cipher_suite] = cs
|
20
20
|
settings_2nd[:ticket_nonce] = nst.ticket_nonce
|
21
21
|
settings_2nd[:ticket_age_add] = nst.ticket_age_add
|
data/interop/client_spec.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative '
|
4
|
+
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
FIXTURES_DIR = __dir__ + '/../spec/fixtures'
|
7
|
-
PORT =
|
7
|
+
PORT = 14433
|
8
8
|
|
9
9
|
RSpec.describe Client do
|
10
10
|
# normal [Boolean] Is this nominal scenarios?
|
@@ -173,6 +173,7 @@ RSpec.describe Client do
|
|
173
173
|
+ '-tls1_3 ' \
|
174
174
|
+ '-www ' \
|
175
175
|
+ '-quiet ' \
|
176
|
+
+ "-accept #{PORT} " \
|
176
177
|
+ opt
|
177
178
|
pid = spawn('docker run ' \
|
178
179
|
+ "--volume #{FIXTURES_DIR}:/tmp " \
|
data/interop/server_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: ascii-8bit
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require_relative '
|
4
|
+
require_relative 'spec_helper'
|
5
5
|
|
6
6
|
FIXTURES_DIR = __dir__ + '/../spec/fixtures'
|
7
7
|
PORT = 4433
|
@@ -187,8 +187,6 @@ RSpec.describe Server do
|
|
187
187
|
|
188
188
|
let(:client) do
|
189
189
|
ip = Socket.ip_address_list.find(&:ipv4_private?).ip_address
|
190
|
-
wait_to_listen(ip, PORT)
|
191
|
-
|
192
190
|
cmd = 'echo -n ping | openssl s_client ' \
|
193
191
|
+ "-connect local:#{PORT} " \
|
194
192
|
+ '-tls1_3 ' \
|
@@ -13,13 +13,20 @@ include TTTLS13::Error
|
|
13
13
|
# rubocop: enable Style/MixinUsage
|
14
14
|
|
15
15
|
def wait_to_listen(host, port)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
10.times do
|
17
|
+
soc = TCPSocket.open(host, port)
|
18
|
+
ctx = OpenSSL::SSL::SSLContext.new
|
19
|
+
ctx.max_version = OpenSSL::SSL::TLS1_3_VERSION
|
20
|
+
ssl = OpenSSL::SSL::SSLSocket.new(soc, ctx)
|
21
|
+
ssl.sync_close = true
|
22
|
+
ssl.connect
|
23
|
+
rescue => e # rubocop: disable Style/RescueStandardError
|
24
|
+
p e
|
25
|
+
soc&.close
|
26
|
+
sleep(0.5)
|
20
27
|
next
|
21
28
|
else
|
22
|
-
|
29
|
+
ssl.close
|
23
30
|
break
|
24
31
|
end
|
25
32
|
end
|
data/lib/tttls1.3/client.rb
CHANGED
@@ -58,7 +58,9 @@ module TTTLS13
|
|
58
58
|
alpn: nil,
|
59
59
|
process_new_session_ticket: nil,
|
60
60
|
ticket: nil,
|
61
|
+
# @deprecated Please use `resumption_secret` instead
|
61
62
|
resumption_master_secret: nil,
|
63
|
+
resumption_secret: nil,
|
62
64
|
psk_cipher_suite: nil,
|
63
65
|
ticket_nonce: nil,
|
64
66
|
ticket_age_add: nil,
|
@@ -84,6 +86,15 @@ module TTTLS13
|
|
84
86
|
@endpoint = :client
|
85
87
|
@hostname = hostname
|
86
88
|
@settings = DEFAULT_CLIENT_SETTINGS.merge(settings)
|
89
|
+
# NOTE: backward compatibility
|
90
|
+
if @settings[:resumption_secret].nil? &&
|
91
|
+
!@settings[:resumption_master_secret].nil?
|
92
|
+
@settings[:resumption_secret] =
|
93
|
+
@settings.delete(:resumption_master_secret) \
|
94
|
+
end
|
95
|
+
raise Error::ConfigError if @settings[:resumption_secret] !=
|
96
|
+
@settings[:resumption_master_secret]
|
97
|
+
|
87
98
|
logger.level = @settings[:loglevel]
|
88
99
|
|
89
100
|
@early_data = ''
|
@@ -137,7 +148,7 @@ module TTTLS13
|
|
137
148
|
priv_keys = {} # Hash of NamedGroup => OpenSSL::PKey::$Object
|
138
149
|
if use_psk?
|
139
150
|
psk = gen_psk_from_nst(
|
140
|
-
@settings[:
|
151
|
+
@settings[:resumption_secret],
|
141
152
|
@settings[:ticket_nonce],
|
142
153
|
CipherSuite.digest(@settings[:psk_cipher_suite])
|
143
154
|
)
|
@@ -423,8 +434,8 @@ module TTTLS13
|
|
423
434
|
transcript[CH].first.random,
|
424
435
|
key_schedule.server_application_traffic_secret
|
425
436
|
)
|
426
|
-
@
|
427
|
-
@
|
437
|
+
@exporter_secret = key_schedule.exporter_secret
|
438
|
+
@resumption_secret = key_schedule.resumption_secret
|
428
439
|
@state = ClientState::CONNECTED
|
429
440
|
when ClientState::CONNECTED
|
430
441
|
logger.debug('ClientState::CONNECTED')
|
@@ -544,7 +555,7 @@ module TTTLS13
|
|
544
555
|
# @return [Boolean]
|
545
556
|
def use_psk?
|
546
557
|
!@settings[:ticket].nil? &&
|
547
|
-
!@settings[:
|
558
|
+
!@settings[:resumption_secret].nil? &&
|
548
559
|
!@settings[:psk_cipher_suite].nil? &&
|
549
560
|
!@settings[:ticket_nonce].nil? &&
|
550
561
|
!@settings[:ticket_age_add].nil? &&
|
@@ -568,14 +579,14 @@ module TTTLS13
|
|
568
579
|
send_record(ap_record)
|
569
580
|
end
|
570
581
|
|
571
|
-
# @param
|
582
|
+
# @param resumption_secret [String]
|
572
583
|
# @param ticket_nonce [String]
|
573
584
|
# @param digest [String] name of digest algorithm
|
574
585
|
#
|
575
586
|
# @return [String]
|
576
|
-
def gen_psk_from_nst(
|
587
|
+
def gen_psk_from_nst(resumption_secret, ticket_nonce, digest)
|
577
588
|
hash_len = OpenSSL::Digest.new(digest).digest_length
|
578
|
-
KeySchedule.hkdf_expand_label(
|
589
|
+
KeySchedule.hkdf_expand_label(resumption_secret, 'resumption',
|
579
590
|
ticket_nonce, hash_len, digest)
|
580
591
|
end
|
581
592
|
|
@@ -949,7 +960,7 @@ module TTTLS13
|
|
949
960
|
def process_new_session_ticket(nst)
|
950
961
|
super(nst)
|
951
962
|
|
952
|
-
rms = @
|
963
|
+
rms = @resumption_secret
|
953
964
|
cs = @cipher_suite
|
954
965
|
@settings[:process_new_session_ticket]&.call(nst, rms, cs)
|
955
966
|
end
|
data/lib/tttls1.3/connection.rb
CHANGED
@@ -25,7 +25,7 @@ module TTTLS13
|
|
25
25
|
@send_record_size = Message::DEFAULT_RECORD_SIZE_LIMIT
|
26
26
|
@recv_record_size = Message::DEFAULT_RECORD_SIZE_LIMIT
|
27
27
|
@alpn = nil # String
|
28
|
-
@
|
28
|
+
@exporter_secret = nil # String
|
29
29
|
end
|
30
30
|
|
31
31
|
# @raise [TTTLS13::Error::ConfigError]
|
@@ -109,15 +109,15 @@ module TTTLS13
|
|
109
109
|
#
|
110
110
|
# @return [String, nil]
|
111
111
|
def exporter(label, context, key_length)
|
112
|
-
return nil if @
|
112
|
+
return nil if @exporter_secret.nil? || @cipher_suite.nil?
|
113
113
|
|
114
114
|
digest = CipherSuite.digest(@cipher_suite)
|
115
|
-
do_exporter(@
|
115
|
+
do_exporter(@exporter_secret, digest, label, context, key_length)
|
116
116
|
end
|
117
117
|
|
118
118
|
private
|
119
119
|
|
120
|
-
# @param secret [String] (early_)
|
120
|
+
# @param secret [String] (early_)exporter_secret
|
121
121
|
# @param digest [String] name of digest algorithm
|
122
122
|
# @param label [String]
|
123
123
|
# @param context [String]
|
@@ -517,10 +517,8 @@ module TTTLS13
|
|
517
517
|
#
|
518
518
|
# @return [Array of TTTLS13::Message::Extension::SignatureAlgorithms]
|
519
519
|
def do_select_signature_algorithms(signature_algorithms, crt)
|
520
|
-
|
521
|
-
|
522
|
-
pka = OpenSSL::ASN1.decode(spki.to_der)
|
523
|
-
.value.first.value.first.value.first.value.first.value
|
520
|
+
pka = OpenSSL::ASN1.decode(crt.public_key.to_der)
|
521
|
+
.value.first.value.first.value
|
524
522
|
signature_algorithms.select do |sa|
|
525
523
|
case sa
|
526
524
|
when SignatureScheme::ECDSA_SECP256R1_SHA256,
|
@@ -61,8 +61,15 @@ module TTTLS13
|
|
61
61
|
self.class.hkdf_expand_label(secret, 'iv', '', @iv_len, @digest)
|
62
62
|
end
|
63
63
|
|
64
|
+
# @deprecated Please use `early_exporter_secret` instead
|
65
|
+
#
|
64
66
|
# @return [String]
|
65
67
|
def early_exporter_master_secret
|
68
|
+
early_exporter_secret
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [String]
|
72
|
+
def early_exporter_secret
|
66
73
|
hash = OpenSSL::Digest.digest(@digest, '')
|
67
74
|
derive_secret(early_secret, 'e exp master', hash)
|
68
75
|
end
|
@@ -126,22 +133,36 @@ module TTTLS13
|
|
126
133
|
self.class.hkdf_expand_label(secret, 'iv', '', @iv_len, @digest)
|
127
134
|
end
|
128
135
|
|
136
|
+
# @deprecated Please use `main_salt` instead
|
137
|
+
#
|
129
138
|
# @return [String]
|
130
139
|
def master_salt
|
140
|
+
main_salt
|
141
|
+
end
|
142
|
+
|
143
|
+
# @return [String]
|
144
|
+
def main_salt
|
131
145
|
hash = OpenSSL::Digest.digest(@digest, '')
|
132
146
|
derive_secret(handshake_secret, 'derived', hash)
|
133
147
|
end
|
134
148
|
|
149
|
+
# @deprecated Please use `main_secret` instead
|
150
|
+
#
|
135
151
|
# @return [String]
|
136
152
|
def master_secret
|
153
|
+
main_secret
|
154
|
+
end
|
155
|
+
|
156
|
+
# @return [String]
|
157
|
+
def main_secret
|
137
158
|
ikm = "\x00" * @hash_len
|
138
|
-
hkdf_extract(ikm,
|
159
|
+
hkdf_extract(ikm, main_salt)
|
139
160
|
end
|
140
161
|
|
141
162
|
# @return [String]
|
142
163
|
def client_application_traffic_secret
|
143
164
|
hash = @transcript.hash(@digest, SF)
|
144
|
-
derive_secret(
|
165
|
+
derive_secret(main_secret, 'c ap traffic', hash)
|
145
166
|
end
|
146
167
|
|
147
168
|
# @return [String]
|
@@ -159,7 +180,7 @@ module TTTLS13
|
|
159
180
|
# @return [String]
|
160
181
|
def server_application_traffic_secret
|
161
182
|
hash = @transcript.hash(@digest, SF)
|
162
|
-
derive_secret(
|
183
|
+
derive_secret(main_secret, 's ap traffic', hash)
|
163
184
|
end
|
164
185
|
|
165
186
|
# @return [String]
|
@@ -174,16 +195,30 @@ module TTTLS13
|
|
174
195
|
self.class.hkdf_expand_label(secret, 'iv', '', @iv_len, @digest)
|
175
196
|
end
|
176
197
|
|
198
|
+
# @deprecated Please use `exporter_secret` instead
|
199
|
+
#
|
177
200
|
# @return [String]
|
178
201
|
def exporter_master_secret
|
202
|
+
exporter_secret
|
203
|
+
end
|
204
|
+
|
205
|
+
# @return [String]
|
206
|
+
def exporter_secret
|
179
207
|
hash = @transcript.hash(@digest, SF)
|
180
|
-
derive_secret(
|
208
|
+
derive_secret(main_secret, 'exp master', hash)
|
181
209
|
end
|
182
210
|
|
211
|
+
# @deprecated Please use `resumption_secret` instead
|
212
|
+
#
|
183
213
|
# @return [String]
|
184
214
|
def resumption_master_secret
|
215
|
+
resumption_secret
|
216
|
+
end
|
217
|
+
|
218
|
+
# @return [String]
|
219
|
+
def resumption_secret
|
185
220
|
hash = @transcript.hash(@digest, CF)
|
186
|
-
derive_secret(
|
221
|
+
derive_secret(main_secret, 'res master', hash)
|
187
222
|
end
|
188
223
|
|
189
224
|
# @param ikm [String]
|
@@ -91,8 +91,7 @@ module TTTLS13
|
|
91
91
|
priv_keys = {}
|
92
92
|
kse = groups.map do |group|
|
93
93
|
curve = NamedGroup.curve_name(group)
|
94
|
-
ec = OpenSSL::PKey::EC.
|
95
|
-
ec.generate_key!
|
94
|
+
ec = OpenSSL::PKey::EC.generate(curve)
|
96
95
|
# store private key to do the key-exchange
|
97
96
|
priv_keys.store(group, ec)
|
98
97
|
KeyShareEntry.new(
|
@@ -115,8 +114,7 @@ module TTTLS13
|
|
115
114
|
# @return [OpenSSL::PKey::EC.$Object]
|
116
115
|
def self.gen_sh_key_share(group)
|
117
116
|
curve = NamedGroup.curve_name(group)
|
118
|
-
ec = OpenSSL::PKey::EC.
|
119
|
-
ec.generate_key!
|
117
|
+
ec = OpenSSL::PKey::EC.generate(curve)
|
120
118
|
|
121
119
|
key_share = KeyShare.new(
|
122
120
|
msg_type: HandshakeType::SERVER_HELLO,
|
data/lib/tttls1.3/server.rb
CHANGED
@@ -323,7 +323,7 @@ module TTTLS13
|
|
323
323
|
transcript[CH].first.random,
|
324
324
|
key_schedule.client_application_traffic_secret
|
325
325
|
)
|
326
|
-
@
|
326
|
+
@exporter_secret = key_schedule.exporter_secret
|
327
327
|
@state = ServerState::CONNECTED
|
328
328
|
when ServerState::CONNECTED
|
329
329
|
logger.debug('ServerState::CONNECTED')
|
data/lib/tttls1.3/version.rb
CHANGED
data/spec/connection_spec.rb
CHANGED
@@ -6,13 +6,28 @@ require_relative 'spec_helper'
|
|
6
6
|
RSpec.describe Connection do
|
7
7
|
context 'connection, Simple 1-RTT Handshake,' do
|
8
8
|
let(:key) do
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
n = OpenSSL::BN.new(TESTBINARY_PKEY_MODULUS, 2)
|
10
|
+
e = OpenSSL::BN.new(TESTBINARY_PKEY_PUBLIC_EXPONENT, 2)
|
11
|
+
d = OpenSSL::BN.new(TESTBINARY_PKEY_PRIVATE_EXPONENT, 2)
|
12
|
+
p = OpenSSL::BN.new(TESTBINARY_PKEY_PRIME1, 2)
|
13
|
+
q = OpenSSL::BN.new(TESTBINARY_PKEY_PRIME2, 2)
|
14
|
+
dmp1 = d % (p - 1.to_bn)
|
15
|
+
dmq1 = d % (q - 1.to_bn)
|
16
|
+
iqmp = q**-1.to_bn % p
|
17
|
+
asn1 = OpenSSL::ASN1::Sequence(
|
18
|
+
[
|
19
|
+
OpenSSL::ASN1::Integer(0),
|
20
|
+
OpenSSL::ASN1::Integer(n),
|
21
|
+
OpenSSL::ASN1::Integer(e),
|
22
|
+
OpenSSL::ASN1::Integer(d),
|
23
|
+
OpenSSL::ASN1::Integer(p),
|
24
|
+
OpenSSL::ASN1::Integer(q),
|
25
|
+
OpenSSL::ASN1::Integer(dmp1),
|
26
|
+
OpenSSL::ASN1::Integer(dmq1),
|
27
|
+
OpenSSL::ASN1::Integer(iqmp)
|
28
|
+
]
|
29
|
+
)
|
30
|
+
OpenSSL::PKey::RSA.new(asn1)
|
16
31
|
end
|
17
32
|
|
18
33
|
let(:ct) do
|
data/spec/extensions_spec.rb
CHANGED
data/spec/key_schedule_spec.rb
CHANGED
@@ -37,9 +37,9 @@ RSpec.describe KeySchedule do
|
|
37
37
|
.to eq TESTBINARY_C_AP_TRAFFIC
|
38
38
|
expect(key_schedule.server_application_traffic_secret)
|
39
39
|
.to eq TESTBINARY_S_AP_TRAFFIC
|
40
|
-
expect(key_schedule.
|
40
|
+
expect(key_schedule.exporter_secret)
|
41
41
|
.to eq TESTBINARY_EXP_MASTER
|
42
|
-
expect(key_schedule.
|
42
|
+
expect(key_schedule.resumption_secret)
|
43
43
|
.to eq TESTBINARY_RES_MASTER
|
44
44
|
end
|
45
45
|
|
data/spec/server_spec.rb
CHANGED
@@ -109,13 +109,28 @@ RSpec.describe Server do
|
|
109
109
|
|
110
110
|
context 'server' do
|
111
111
|
let(:key) do
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
112
|
+
n = OpenSSL::BN.new(TESTBINARY_PKEY_MODULUS, 2)
|
113
|
+
e = OpenSSL::BN.new(TESTBINARY_PKEY_PUBLIC_EXPONENT, 2)
|
114
|
+
d = OpenSSL::BN.new(TESTBINARY_PKEY_PRIVATE_EXPONENT, 2)
|
115
|
+
p = OpenSSL::BN.new(TESTBINARY_PKEY_PRIME1, 2)
|
116
|
+
q = OpenSSL::BN.new(TESTBINARY_PKEY_PRIME2, 2)
|
117
|
+
dmp1 = d % (p - 1.to_bn)
|
118
|
+
dmq1 = d % (q - 1.to_bn)
|
119
|
+
iqmp = q**-1.to_bn % p
|
120
|
+
asn1 = OpenSSL::ASN1::Sequence(
|
121
|
+
[
|
122
|
+
OpenSSL::ASN1::Integer(0),
|
123
|
+
OpenSSL::ASN1::Integer(n),
|
124
|
+
OpenSSL::ASN1::Integer(e),
|
125
|
+
OpenSSL::ASN1::Integer(d),
|
126
|
+
OpenSSL::ASN1::Integer(p),
|
127
|
+
OpenSSL::ASN1::Integer(q),
|
128
|
+
OpenSSL::ASN1::Integer(dmp1),
|
129
|
+
OpenSSL::ASN1::Integer(dmq1),
|
130
|
+
OpenSSL::ASN1::Integer(iqmp)
|
131
|
+
]
|
132
|
+
)
|
133
|
+
OpenSSL::PKey::RSA.new(asn1)
|
119
134
|
end
|
120
135
|
|
121
136
|
let(:ct) do
|
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.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thekuwayama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,8 +78,8 @@ files:
|
|
78
78
|
- example/https_client_using_ticket.rb
|
79
79
|
- example/https_server.rb
|
80
80
|
- interop/client_spec.rb
|
81
|
-
- interop/helper.rb
|
82
81
|
- interop/server_spec.rb
|
82
|
+
- interop/spec_helper.rb
|
83
83
|
- lib/tttls1.3.rb
|
84
84
|
- lib/tttls1.3/cipher_suites.rb
|
85
85
|
- lib/tttls1.3/client.rb
|