summaryrefslogtreecommitdiff
path: root/test/openssl/utils.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-06-05 21:07:27 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-06-06 14:20:58 +0900
commit1e54903684aa3c9ea3fe54520157846a1b1f07be (patch)
tree72b7ea26c1b0f7026bdbef83ccd64041d04d583f /test/openssl/utils.rb
parentd046fe926273d0137f2d5cdf2dedfcfeeb98189b (diff)
test/openssl: Support OpenSSL 1.1.1
OpenSSL 1.1.1 rejects some shorter keys, which caused some failures of `make test-all TESTS=openssl`. https://rubyci.org/logs/rubyci.s3.amazonaws.com/debian/ruby-master/log/20190606T003005Z.fail.html.gz This change merges 6bbc31ddd1 and 63fb3a36d1 in https://github.com/ruby/openssl. Reference: https://github.com/ruby/openssl/pull/217
Diffstat (limited to 'test/openssl/utils.rb')
-rw-r--r--test/openssl/utils.rb14
1 files changed, 6 insertions, 8 deletions
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index 6318246ddb..1da3d8f797 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -42,10 +42,8 @@ module OpenSSL::TestUtils
def pkey(name)
OpenSSL::PKey.read(read_file("pkey", name))
- end
-
- def pkey_dh(name)
- # DH parameters can be read by OpenSSL::PKey.read atm
+ rescue OpenSSL::PKey::PKeyError
+ # TODO: DH parameters can be read by OpenSSL::PKey.read atm
OpenSSL::PKey::DH.new(read_file("pkey", name))
end
@@ -157,9 +155,9 @@ class OpenSSL::SSLTestCase < OpenSSL::TestCase
def setup
super
- @ca_key = Fixtures.pkey("rsa2048")
- @svr_key = Fixtures.pkey("rsa1024")
- @cli_key = Fixtures.pkey("rsa2048")
+ @ca_key = Fixtures.pkey("rsa-1")
+ @svr_key = Fixtures.pkey("rsa-2")
+ @cli_key = Fixtures.pkey("rsa-3")
@ca = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=CA")
@svr = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=localhost")
@cli = OpenSSL::X509::Name.parse("/DC=org/DC=ruby-lang/CN=localhost")
@@ -200,7 +198,7 @@ class OpenSSL::SSLTestCase < OpenSSL::TestCase
ctx.cert_store = store
ctx.cert = @svr_cert
ctx.key = @svr_key
- ctx.tmp_dh_callback = proc { Fixtures.pkey_dh("dh1024") }
+ ctx.tmp_dh_callback = proc { Fixtures.pkey("dh-1") }
ctx.verify_mode = verify_mode
ctx_proc.call(ctx) if ctx_proc