localhost 1.1.3 → 1.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1b86e2157a0bb7ccb760179614cc9a49f2b4301870838f049aa9802a76cb2dec
4
- data.tar.gz: ecb0ee7388befd62714e953f89cf2cdaf1d721bf628384dc9f5d3faf09e0d25a
3
+ metadata.gz: 3aedd0578ec88a4e5f4e8a4f485607ff16a4a132e0f5c5cebdc3c80e29ade744
4
+ data.tar.gz: c6aa53e08063c1202b60148a04ae1391aa42c9cdbefe920723bf641a9f969741
5
5
  SHA512:
6
- metadata.gz: 2d8269e428c27e72cbc812d8c3201e0d06fc10e650036245b46e5c2f12f37d871a7bdb49a764d10540ba81f86105791e123381ba42dcb60553a4d88299b811ac
7
- data.tar.gz: 42e81d392df2945a45ec85ffce3e6e3402bc9d2d0e1ad3fd5eef9541102e26ab530abfeb6442d662a8389fea46103bf5112324b9bd5f9478335e7d6cbbdb17e4
6
+ metadata.gz: 5b8cbd0e0db9d5d1368f768c3171e0dac6217d6b5a400e33678028844bb1643604eaa8633552b61e018892e6cb98af9e3de5b0db6ae90111169b03f906667ce4
7
+ data.tar.gz: 5cef990c8f1d88a315a4429274463ebf04ed63c5251a895eeb1bc1f9f97c50ef907f20e52b75b28dd919e9e363690eca6e71b7a21c558968caf631c7e81d4c1d
@@ -49,8 +49,18 @@ module Localhost
49
49
  @store = nil
50
50
  end
51
51
 
52
+ BITS = 1024*2
53
+
54
+ def ecdh_key
55
+ @ecdh_key ||= OpenSSL::PKey::EC.new "prime256v1"
56
+ end
57
+
58
+ def dh_key
59
+ @dh_key ||= OpenSSL::PKey::DH.new(BITS)
60
+ end
61
+
52
62
  def key
53
- @key ||= OpenSSL::PKey::RSA.new(1024*2)
63
+ @key ||= OpenSSL::PKey::RSA.new(BITS)
54
64
  end
55
65
 
56
66
  def key= key
@@ -111,6 +121,16 @@ module Localhost
111
121
 
112
122
  context.session_id_context = "localhost"
113
123
 
124
+ if context.respond_to? :tmp_dh_callback=
125
+ context.tmp_dh_callback = proc {self.dh_key}
126
+ end
127
+
128
+ if context.respond_to? :ecdh_curves=
129
+ context.ecdh_curves = 'P-256:P-384:P-224:P-521'
130
+ elsif context.respond_to? :tmp_ecdh_callback=
131
+ context.tmp_ecdh_callback = proc {self.ecdh_key}
132
+ end
133
+
114
134
  context.set_params(
115
135
  ciphers: SERVER_CIPHERS
116
136
  )
@@ -128,7 +148,7 @@ module Localhost
128
148
  end
129
149
 
130
150
  def load(path)
131
- if File.directory? path
151
+ if File.directory? path
132
152
  certificate_path = File.join(path, "#{@hostname}.crt")
133
153
  key_path = File.join(path, "#{@hostname}.key")
134
154
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Localhost
22
- VERSION = "1.1.3"
22
+ VERSION = "1.1.4"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localhost
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  requirements: []
92
92
  rubyforge_project:
93
- rubygems_version: 2.7.7
93
+ rubygems_version: 2.7.6
94
94
  signing_key:
95
95
  specification_version: 4
96
96
  summary: Manage a local certificate authority for self-signed localhost development