summaryrefslogtreecommitdiff
path: root/sample/openssl/echo_svr.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-02-25 16:55:40 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-03-16 19:37:06 +0900
commit7f0b3fb9060b75b4f15b8e7e5866d2c13c132c29 (patch)
treec1d45b5d6727f72840c9ae9cd371cce61738bc1d /sample/openssl/echo_svr.rb
parente35d3623de47b1a8d699f431460fbcba36de84f2 (diff)
[ruby/openssl] sample: update obsolete API use
https://github.com/ruby/openssl/commit/dafa851c0d
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4275
Diffstat (limited to 'sample/openssl/echo_svr.rb')
-rw-r--r--sample/openssl/echo_svr.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/sample/openssl/echo_svr.rb b/sample/openssl/echo_svr.rb
index 1cc07b9b96..f20fb52bf5 100644
--- a/sample/openssl/echo_svr.rb
+++ b/sample/openssl/echo_svr.rb
@@ -15,7 +15,7 @@ if cert_file && key_file
cert = OpenSSL::X509::Certificate.new(File::read(cert_file))
key = OpenSSL::PKey.read(File::read(key_file))
else
- key = OpenSSL::PKey::RSA.new(512){ print "." }
+ key = OpenSSL::PKey::RSA.new(2048){ print "." }
puts
cert = OpenSSL::X509::Certificate.new
cert.version = 2
@@ -25,7 +25,7 @@ else
cert.issuer = name
cert.not_before = Time.now
cert.not_after = Time.now + 3600
- cert.public_key = key.public_key
+ cert.public_key = key
ef = OpenSSL::X509::ExtensionFactory.new(nil,cert)
cert.extensions = [
ef.create_extension("basicConstraints","CA:FALSE"),
@@ -37,7 +37,7 @@ else
ef.issuer_certificate = cert
cert.add_extension ef.create_extension("authorityKeyIdentifier",
"keyid:always,issuer:always")
- cert.sign(key, OpenSSL::Digest.new('SHA1'))
+ cert.sign(key, "SHA1")
end
ctx = OpenSSL::SSL::SSLContext.new()