tttls1.3 0.3.5 → 0.3.7

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/Gemfile +2 -2
  4. data/README.md +1 -1
  5. data/lib/tttls1.3/client.rb +11 -5
  6. data/lib/tttls1.3/ech.rb +31 -90
  7. data/lib/tttls1.3/message/alert.rb +1 -0
  8. data/lib/tttls1.3/sslkeylogfile.rb +22 -0
  9. data/lib/tttls1.3/version.rb +1 -1
  10. data/lib/tttls1.3.rb +1 -0
  11. data/tttls1.3.gemspec +7 -4
  12. metadata +11 -121
  13. data/.github/workflows/ci.yml +0 -39
  14. data/.gitignore +0 -17
  15. data/spec/aead_spec.rb +0 -95
  16. data/spec/alert_spec.rb +0 -54
  17. data/spec/alpn_spec.rb +0 -55
  18. data/spec/application_data_spec.rb +0 -26
  19. data/spec/certificate_spec.rb +0 -82
  20. data/spec/certificate_verify_spec.rb +0 -51
  21. data/spec/change_cipher_spec_spec.rb +0 -26
  22. data/spec/cipher_suites_spec.rb +0 -39
  23. data/spec/client_hello_spec.rb +0 -105
  24. data/spec/client_spec.rb +0 -274
  25. data/spec/compress_certificate_spec.rb +0 -54
  26. data/spec/cookie_spec.rb +0 -98
  27. data/spec/early_data_indication_spec.rb +0 -64
  28. data/spec/ech_outer_extensions_spec.rb +0 -42
  29. data/spec/ech_spec.rb +0 -122
  30. data/spec/encrypted_extensions_spec.rb +0 -94
  31. data/spec/end_of_early_data_spec.rb +0 -28
  32. data/spec/endpoint_spec.rb +0 -167
  33. data/spec/error_spec.rb +0 -18
  34. data/spec/extensions_spec.rb +0 -250
  35. data/spec/finished_spec.rb +0 -55
  36. data/spec/fixtures/rsa_ca.crt +0 -18
  37. data/spec/fixtures/rsa_ca.key +0 -27
  38. data/spec/fixtures/rsa_rsa.crt +0 -18
  39. data/spec/fixtures/rsa_rsa.key +0 -27
  40. data/spec/fixtures/rsa_rsa_ocsp.crt +0 -18
  41. data/spec/fixtures/rsa_rsa_ocsp.key +0 -27
  42. data/spec/fixtures/rsa_rsassaPss.crt +0 -20
  43. data/spec/fixtures/rsa_rsassaPss.key +0 -27
  44. data/spec/fixtures/rsa_secp256r1.crt +0 -14
  45. data/spec/fixtures/rsa_secp256r1.key +0 -5
  46. data/spec/fixtures/rsa_secp384r1.crt +0 -14
  47. data/spec/fixtures/rsa_secp384r1.key +0 -6
  48. data/spec/fixtures/rsa_secp521r1.crt +0 -15
  49. data/spec/fixtures/rsa_secp521r1.key +0 -7
  50. data/spec/key_schedule_spec.rb +0 -221
  51. data/spec/key_share_spec.rb +0 -199
  52. data/spec/new_session_ticket_spec.rb +0 -80
  53. data/spec/pre_shared_key_spec.rb +0 -167
  54. data/spec/psk_key_exchange_modes_spec.rb +0 -45
  55. data/spec/record_size_limit_spec.rb +0 -61
  56. data/spec/record_spec.rb +0 -105
  57. data/spec/server_hello_spec.rb +0 -200
  58. data/spec/server_name_spec.rb +0 -110
  59. data/spec/server_spec.rb +0 -232
  60. data/spec/signature_algorithms_cert_spec.rb +0 -77
  61. data/spec/signature_algorithms_spec.rb +0 -104
  62. data/spec/spec_helper.rb +0 -990
  63. data/spec/status_request_spec.rb +0 -140
  64. data/spec/supported_groups_spec.rb +0 -79
  65. data/spec/supported_versions_spec.rb +0 -136
  66. data/spec/transcript_spec.rb +0 -83
  67. data/spec/unknown_extension_spec.rb +0 -90
  68. data/spec/utils_spec.rb +0 -235
data/spec/utils_spec.rb DELETED
@@ -1,235 +0,0 @@
1
- # encoding: ascii-8bit
2
- # frozen_string_literal: true
3
-
4
- require_relative 'spec_helper'
5
- using Refinements
6
-
7
- RSpec.describe TTTLS13::Refinements do
8
- context '0' do
9
- let(:integer) do
10
- 0
11
- end
12
-
13
- it 'should return uint8' do
14
- expect(integer.to_uint8.length).to eq 1
15
- expect(integer.to_uint8).to eq "\x00"
16
- end
17
-
18
- it 'should return uint16' do
19
- expect(integer.to_uint16.length).to eq 2
20
- expect(integer.to_uint16).to eq "\x00\x00"
21
- end
22
-
23
- it 'should return uint24' do
24
- expect(integer.to_uint24.length).to eq 3
25
- expect(integer.to_uint24).to eq "\x00\x00\x00"
26
- end
27
-
28
- it 'should return uint32' do
29
- expect(integer.to_uint32.length).to eq 4
30
- expect(integer.to_uint32).to eq "\x00\x00\x00\x00"
31
- end
32
-
33
- it 'should return uint64' do
34
- expect(integer.to_uint64.length).to eq 8
35
- expect(integer.to_uint64).to eq "\x00\x00\x00\x00\x00\x00\x00\x00"
36
- end
37
- end
38
-
39
- context '-1' do
40
- let(:integer) do
41
- -1
42
- end
43
-
44
- it 'should not return uint8' do
45
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
46
- end
47
-
48
- it 'should not return uint16' do
49
- expect { integer.to_uint16 }.to raise_error(ErrorAlerts)
50
- end
51
-
52
- it 'should not return uint24' do
53
- expect { integer.to_uint24 }.to raise_error(ErrorAlerts)
54
- end
55
-
56
- it 'should not return uint32' do
57
- expect { integer.to_uint32 }.to raise_error(ErrorAlerts)
58
- end
59
-
60
- it 'should not return uint64' do
61
- expect { integer.to_uint64 }.to raise_error(ErrorAlerts)
62
- end
63
- end
64
-
65
- context '1 << 8' do
66
- let(:integer) do
67
- 1 << 8
68
- end
69
-
70
- it 'should not return uint8' do
71
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
72
- end
73
-
74
- it 'should return uint16' do
75
- expect(integer.to_uint16.length).to eq 2
76
- expect(integer.to_uint16).to eq "\x01\x00"
77
- end
78
-
79
- it 'should return uint24' do
80
- expect(integer.to_uint24.length).to eq 3
81
- expect(integer.to_uint24).to eq "\x00\x01\x00"
82
- end
83
-
84
- it 'should return uint32' do
85
- expect(integer.to_uint32.length).to eq 4
86
- expect(integer.to_uint32).to eq "\x00\x00\x01\x00"
87
- end
88
-
89
- it 'should return uint64' do
90
- expect(integer.to_uint64.length).to eq 8
91
- expect(integer.to_uint64).to eq "\x00\x00\x00\x00\x00\x00\x01\x00"
92
- end
93
- end
94
-
95
- context '1 << 16' do
96
- let(:integer) do
97
- 1 << 16
98
- end
99
-
100
- it 'should not return uint8' do
101
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
102
- end
103
-
104
- it 'should not return uint16' do
105
- expect { integer.to_uint16 }.to raise_error(ErrorAlerts)
106
- end
107
-
108
- it 'should return uint24' do
109
- expect(integer.to_uint24.length).to eq 3
110
- expect(integer.to_uint24).to eq "\x01\x00\x00"
111
- end
112
-
113
- it 'should return uint32' do
114
- expect(integer.to_uint32.length).to eq 4
115
- expect(integer.to_uint32).to eq "\x00\x01\x00\x00"
116
- end
117
-
118
- it 'should return uint64' do
119
- expect(integer.to_uint64.length).to eq 8
120
- expect(integer.to_uint64).to eq "\x00\x00\x00\x00\x00\x01\x00\x00"
121
- end
122
- end
123
-
124
- context '1 << 24' do
125
- let(:integer) do
126
- 1 << 24
127
- end
128
-
129
- it 'should not return uint8' do
130
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
131
- end
132
-
133
- it 'should not return uint16' do
134
- expect { integer.to_uint16 }.to raise_error(ErrorAlerts)
135
- end
136
-
137
- it 'should not return uint24' do
138
- expect { integer.to_uint24 }.to raise_error(ErrorAlerts)
139
- end
140
-
141
- it 'should return uint32' do
142
- expect(integer.to_uint32.length).to eq 4
143
- expect(integer.to_uint32).to eq "\x01\x00\x00\x00"
144
- end
145
-
146
- it 'should return uint64' do
147
- expect(integer.to_uint64.length).to eq 8
148
- expect(integer.to_uint64).to eq "\x00\x00\x00\x00\x01\x00\x00\x00"
149
- end
150
- end
151
-
152
- context '1 << 32' do
153
- let(:integer) do
154
- 1 << 32
155
- end
156
-
157
- it 'should not return uint8' do
158
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
159
- end
160
-
161
- it 'should not return uint16' do
162
- expect { integer.to_uint16 }.to raise_error(ErrorAlerts)
163
- end
164
-
165
- it 'should not return uint24' do
166
- expect { integer.to_uint24 }.to raise_error(ErrorAlerts)
167
- end
168
-
169
- it 'should not return uint32' do
170
- expect { integer.to_uint32 }.to raise_error(ErrorAlerts)
171
- end
172
-
173
- it 'should return uint64' do
174
- expect(integer.to_uint64.length).to eq 8
175
- expect(integer.to_uint64).to eq "\x00\x00\x00\x01\x00\x00\x00\x00"
176
- end
177
- end
178
-
179
- context '1 << 64' do
180
- let(:integer) do
181
- 1 << 64
182
- end
183
-
184
- it 'should not return uint8' do
185
- expect { integer.to_uint8 }.to raise_error(ErrorAlerts)
186
- end
187
-
188
- it 'should not return uint16' do
189
- expect { integer.to_uint16 }.to raise_error(ErrorAlerts)
190
- end
191
-
192
- it 'should not return uint24' do
193
- expect { integer.to_uint24 }.to raise_error(ErrorAlerts)
194
- end
195
-
196
- it 'should not return uint32' do
197
- expect { integer.to_uint32 }.to raise_error(ErrorAlerts)
198
- end
199
-
200
- it 'should not return uint64' do
201
- expect { integer.to_uint64 }.to raise_error(ErrorAlerts)
202
- end
203
- end
204
-
205
- context 'string' do
206
- let(:string) do
207
- 'string'
208
- end
209
-
210
- it 'should be prefixed' do
211
- expect(string.prefix_uint8_length)
212
- .to eq "\x06string"
213
- expect(string.prefix_uint16_length)
214
- .to eq "\x00\x06string"
215
- expect(string.prefix_uint24_length)
216
- .to eq "\x00\x00\x06string"
217
- expect(string.prefix_uint32_length)
218
- .to eq "\x00\x00\x00\x06string"
219
- expect(string.prefix_uint64_length)
220
- .to eq "\x00\x00\x00\x00\x00\x00\x00\x06string"
221
- end
222
- end
223
- end
224
-
225
- RSpec.describe Convert do
226
- context 'binary' do
227
- let(:binary) do
228
- "\x01\x23\x45\x67\x89"
229
- end
230
-
231
- it 'should be converted to integer' do
232
- expect(Convert.bin2i(binary)).to eq 4886718345
233
- end
234
- end
235
- end