tttls1.3 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +3 -0
  3. data/README.md +35 -13
  4. data/Rakefile +2 -4
  5. data/example/helper.rb +30 -7
  6. data/example/https_client.rb +3 -20
  7. data/example/https_client_using_0rtt.rb +10 -24
  8. data/example/https_client_using_hrr.rb +3 -20
  9. data/example/https_client_using_ticket.rb +3 -20
  10. data/example/https_server.rb +43 -0
  11. data/interop/client_spec.rb +111 -22
  12. data/interop/helper.rb +1 -0
  13. data/interop/server_spec.rb +182 -0
  14. data/lib/tttls1.3/client.rb +115 -98
  15. data/lib/tttls1.3/connection.rb +119 -32
  16. data/lib/tttls1.3/message/certificate.rb +18 -0
  17. data/lib/tttls1.3/message/client_hello.rb +38 -0
  18. data/lib/tttls1.3/message/encrypted_extensions.rb +20 -16
  19. data/lib/tttls1.3/message/extension/key_share.rb +24 -2
  20. data/lib/tttls1.3/message/extension/supported_groups.rb +0 -87
  21. data/lib/tttls1.3/message/extensions.rb +1 -27
  22. data/lib/tttls1.3/message/new_session_ticket.rb +14 -0
  23. data/lib/tttls1.3/message/record.rb +23 -20
  24. data/lib/tttls1.3/message/server_hello.rb +27 -0
  25. data/lib/tttls1.3/message.rb +35 -2
  26. data/lib/tttls1.3/named_group.rb +89 -0
  27. data/lib/tttls1.3/server.rb +439 -0
  28. data/lib/tttls1.3/transcript.rb +6 -0
  29. data/lib/tttls1.3/version.rb +1 -1
  30. data/lib/tttls1.3.rb +3 -0
  31. data/spec/certificate_spec.rb +28 -1
  32. data/spec/client_spec.rb +14 -10
  33. data/spec/connection_spec.rb +43 -13
  34. data/spec/encrypted_extensions_spec.rb +4 -4
  35. data/spec/fixtures/rsa_ca.crt +29 -0
  36. data/spec/fixtures/rsa_ca.key +51 -0
  37. data/spec/fixtures/rsa_rsa.crt +23 -0
  38. data/spec/fixtures/rsa_rsa.key +27 -0
  39. data/spec/fixtures/rsa_secp256r1.crt +19 -0
  40. data/spec/fixtures/rsa_secp256r1.key +5 -0
  41. data/spec/fixtures/rsa_secp384r1.crt +19 -0
  42. data/spec/fixtures/rsa_secp384r1.key +6 -0
  43. data/spec/fixtures/rsa_secp521r1.crt +20 -0
  44. data/spec/fixtures/rsa_secp521r1.key +7 -0
  45. data/spec/server_spec.rb +186 -0
  46. data/spec/spec_helper.rb +43 -0
  47. metadata +28 -2
data/spec/spec_helper.rb CHANGED
@@ -9,6 +9,7 @@ include TTTLS13
9
9
  include TTTLS13::Error
10
10
  include TTTLS13::CipherSuite
11
11
  include TTTLS13::SignatureScheme
12
+ include TTTLS13::NamedGroup
12
13
  include TTTLS13::Cryptograph
13
14
  include TTTLS13::Message
14
15
  include TTTLS13::Message::Extension
@@ -128,6 +129,48 @@ BIN
128
129
 
129
130
  TESTBINARY_EARLY_DATA_INDICATION_CH = ''
130
131
 
132
+ # https://tools.ietf.org/html/rfc8448#section-3
133
+ # 2. Private Keys
134
+ TESTBINARY_PKEY_MODULUS = <<BIN.split.map(&:hex).map(&:chr).join
135
+ b4 bb 49 8f 82 79 30 3d 98 08 36 39 9b 36 c6 98
136
+ 8c 0c 68 de 55 e1 bd b8 26 d3 90 1a 24 61 ea fd
137
+ 2d e4 9a 91 d0 15 ab bc 9a 95 13 7a ce 6c 1a f1
138
+ 9e aa 6a f9 8c 7c ed 43 12 09 98 e1 87 a8 0e e0
139
+ cc b0 52 4b 1b 01 8c 3e 0b 63 26 4d 44 9a 6d 38
140
+ e2 2a 5f da 43 08 46 74 80 30 53 0e f0 46 1c 8c
141
+ a9 d9 ef bf ae 8e a6 d1 d0 3e 2b d1 93 ef f0 ab
142
+ 9a 80 02 c4 74 28 a6 d3 5a 8d 88 d7 9f 7f 1e 3f
143
+ BIN
144
+
145
+ TESTBINARY_PKEY_PUBLIC_EXPONENT = <<BIN.split.map(&:hex).map(&:chr).join
146
+ 01 00 01
147
+ BIN
148
+
149
+ TESTBINARY_PKEY_PRIME1 = <<BIN.split.map(&:hex).map(&:chr).join
150
+ e4 35 fb 7c c8 37 37 75 6d ac ea 96 ab 7f 59 a2
151
+ cc 10 69 db 7d eb 19 0e 17 e3 3a 53 2b 27 3f 30
152
+ a3 27 aa 0a aa bc 58 cd 67 46 6a f9 84 5f ad c6
153
+ 75 fe 09 4a f9 2c 4b d1 f2 c1 bc 33 dd 2e 05 15
154
+ BIN
155
+
156
+ TESTBINARY_PKEY_PRIME2 = <<BIN.split.map(&:hex).map(&:chr).join
157
+ ca bd 3b c0 e0 43 86 64 c8 d4 cc 9f 99 97 7a 94
158
+ d9 bb fe ad 8e 43 87 0a ba e3 f7 eb 8b 4e 0e ee
159
+ 8a f1 d9 b4 71 9b a6 19 6c f2 cb ba ee eb f8 b3
160
+ 49 0a fe 9e 9f fa 74 a8 8a a5 1f c6 45 62 93 03
161
+ BIN
162
+
163
+ TESTBINARY_PKEY_PRIVATE_EXPONENT = <<BIN.split.map(&:hex).map(&:chr).join
164
+ 04 de a7 05 d4 3a 6e a7 20 9d d8 07 21 11 a8 3c
165
+ 81 e3 22 a5 92 78 b3 34 80 64 1e af 7c 0a 69 85
166
+ b8 e3 1c 44 f6 de 62 e1 b4 c2 30 9f 61 26 e7 7b
167
+ 7c 41 e9 23 31 4b bf a3 88 13 05 dc 12 17 f1 6c
168
+ 81 9c e5 38 e9 22 f3 69 82 8d 0e 57 19 5d 8c 84
169
+ 88 46 02 07 b2 fa a7 26 bc f7 08 bb d7 db 7f 67
170
+ 9f 89 34 92 fc 2a 62 2e 08 97 0a ac 44 1c e4 e0
171
+ c3 08 8d f2 5a e6 79 23 3d f8 a3 bd a2 ff 99 41
172
+ BIN
173
+
131
174
  # https://tools.ietf.org/html/rfc8448#section-3
132
175
  # 3. Simple 1-RTT Handshake
133
176
  TESTBINARY_CLIENT_HELLO = <<BIN.split.map(&:hex).map(&:chr).join
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.1.4
4
+ version: 0.2.0
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-15 00:00:00.000000000 Z
11
+ date: 2019-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,9 +72,11 @@ files:
72
72
  - example/https_client_using_0rtt.rb
73
73
  - example/https_client_using_hrr.rb
74
74
  - example/https_client_using_ticket.rb
75
+ - example/https_server.rb
75
76
  - interop/Dockerfile
76
77
  - interop/client_spec.rb
77
78
  - interop/helper.rb
79
+ - interop/server_spec.rb
78
80
  - lib/tttls1.3.rb
79
81
  - lib/tttls1.3/cipher_suites.rb
80
82
  - lib/tttls1.3/client.rb
@@ -113,7 +115,9 @@ files:
113
115
  - lib/tttls1.3/message/new_session_ticket.rb
114
116
  - lib/tttls1.3/message/record.rb
115
117
  - lib/tttls1.3/message/server_hello.rb
118
+ - lib/tttls1.3/named_group.rb
116
119
  - lib/tttls1.3/sequence_number.rb
120
+ - lib/tttls1.3/server.rb
117
121
  - lib/tttls1.3/signature_scheme.rb
118
122
  - lib/tttls1.3/transcript.rb
119
123
  - lib/tttls1.3/utils.rb
@@ -135,6 +139,16 @@ files:
135
139
  - spec/error_spec.rb
136
140
  - spec/extensions_spec.rb
137
141
  - spec/finished_spec.rb
142
+ - spec/fixtures/rsa_ca.crt
143
+ - spec/fixtures/rsa_ca.key
144
+ - spec/fixtures/rsa_rsa.crt
145
+ - spec/fixtures/rsa_rsa.key
146
+ - spec/fixtures/rsa_secp256r1.crt
147
+ - spec/fixtures/rsa_secp256r1.key
148
+ - spec/fixtures/rsa_secp384r1.crt
149
+ - spec/fixtures/rsa_secp384r1.key
150
+ - spec/fixtures/rsa_secp521r1.crt
151
+ - spec/fixtures/rsa_secp521r1.key
138
152
  - spec/key_schedule_spec.rb
139
153
  - spec/key_share_spec.rb
140
154
  - spec/new_session_ticket_spec.rb
@@ -144,6 +158,7 @@ files:
144
158
  - spec/record_spec.rb
145
159
  - spec/server_hello_spec.rb
146
160
  - spec/server_name_spec.rb
161
+ - spec/server_spec.rb
147
162
  - spec/signature_algorithms_cert_spec.rb
148
163
  - spec/signature_algorithms_spec.rb
149
164
  - spec/spec_helper.rb
@@ -195,6 +210,16 @@ test_files:
195
210
  - spec/error_spec.rb
196
211
  - spec/extensions_spec.rb
197
212
  - spec/finished_spec.rb
213
+ - spec/fixtures/rsa_ca.crt
214
+ - spec/fixtures/rsa_ca.key
215
+ - spec/fixtures/rsa_rsa.crt
216
+ - spec/fixtures/rsa_rsa.key
217
+ - spec/fixtures/rsa_secp256r1.crt
218
+ - spec/fixtures/rsa_secp256r1.key
219
+ - spec/fixtures/rsa_secp384r1.crt
220
+ - spec/fixtures/rsa_secp384r1.key
221
+ - spec/fixtures/rsa_secp521r1.crt
222
+ - spec/fixtures/rsa_secp521r1.key
198
223
  - spec/key_schedule_spec.rb
199
224
  - spec/key_share_spec.rb
200
225
  - spec/new_session_ticket_spec.rb
@@ -204,6 +229,7 @@ test_files:
204
229
  - spec/record_spec.rb
205
230
  - spec/server_hello_spec.rb
206
231
  - spec/server_name_spec.rb
232
+ - spec/server_spec.rb
207
233
  - spec/signature_algorithms_cert_spec.rb
208
234
  - spec/signature_algorithms_spec.rb
209
235
  - spec/spec_helper.rb