tttls1.3 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbb7e4290064777d30371999409395c0f2db398d1ee7a67eaaf5fa500de27954
4
- data.tar.gz: 3a00195088a78054fd4abdbf77e11fff3898f23b539d90e3ce141a0ef045f227
3
+ metadata.gz: 7245602faa9087e83b3e47484aa88dc368b153e98c76fd00e36ebb1a863af6ef
4
+ data.tar.gz: c7362f39fc26763f712cdf61a29b3796686c50034d2a6431788d8dbf7dd505c9
5
5
  SHA512:
6
- metadata.gz: 3186fcebd41a40b21c5a4d1de53d13af3ea57dd4d0f3e6baff476882223cc370cb610d9c13cc4df43c3b5b13dd10063b702f39636dd447e9386062de7c566bbc
7
- data.tar.gz: 4c8f6a076e042b1c9059dea5b9598d5bd5d80640b2b72cc859a76d2e020edc047b8309c7821ca849b445c51c41fbcac600363c34881074b28996774d05cc8ffb
6
+ metadata.gz: 33168ef27007f9e6d73197ed3e1bae9b58dadfdf3042e732ddc6a05913db0aad48fb653ea7b7222716d70ebe42739f2d9dddee0ec75ee45eb33daba4be6f0229
7
+ data.tar.gz: d05c73a49e0f5d568785c3b6af3d9bc3c286b35f1110c5f31860f8cf788a9f9e019112fd8647394672c279808e20c4f02d438a58c44f5bab9af1d5fb851ef41f
data/Gemfile CHANGED
@@ -3,6 +3,7 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  gem 'ech_config', '~> 0.0.3'
6
+ gem 'hpke'
6
7
  gem 'logger'
7
8
  gem 'openssl'
8
9
  gem 'rake'
data/example/helper.rb CHANGED
@@ -62,3 +62,24 @@ def recv_http_response(client)
62
62
  parser << client.read until client.eof?
63
63
  buf
64
64
  end
65
+
66
+ def transcript_htmlize(transcript)
67
+ m = {
68
+ TTTLS13::CH1 => 'ClientHello',
69
+ TTTLS13::HRR => 'HelloRetryRequest',
70
+ TTTLS13::CH => 'ClientHello',
71
+ TTTLS13::SH => 'ServerHello',
72
+ TTTLS13::EE => 'EncryptedExtensions',
73
+ TTTLS13::CR => 'CertificateRequest',
74
+ TTTLS13::CT => 'Certificate',
75
+ TTTLS13::CV => 'CertificateVerify',
76
+ TTTLS13::SF => 'Finished',
77
+ TTTLS13::EOED => 'EndOfEarlyData',
78
+ TTTLS13::CCT => 'Certificate',
79
+ TTTLS13::CCV => 'CertificateVerify',
80
+ TTTLS13::CF => 'Finished'
81
+ }.map { |k, v| [k, '<details><summary>' + v + '</summary>%s</details>'] }.to_h
82
+ transcript.map do |k, v|
83
+ format(m[k], TTTLS13::Convert.obj2html(v.first))
84
+ end.join('<br>')
85
+ end
@@ -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[:resumption_main_secret] = rms
18
+ settings_2nd[:resumption_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
@@ -30,7 +30,20 @@ Etc.nprocessors.times do
30
30
  parser.on_message_complete = lambda do
31
31
  if !parser.http_method.nil?
32
32
  logger.info 'Receive Request'
33
- server.write(simple_http_response('TEST'))
33
+ html = <<HTML
34
+ <!DOCTYPE html>
35
+ <html>
36
+ <head>
37
+ <meta charset="UTF-8" />
38
+ <title>tttls1.3 test server</title>
39
+ </head>
40
+ <body>
41
+ %s
42
+ </body>
43
+ </html>
44
+ HTML
45
+ html = format(html, transcript_htmlize(server.transcript))
46
+ server.write(simple_http_response(html))
34
47
  server.close
35
48
  else
36
49
  logger.warn 'Not Request'