summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2017-03-22 03:51:24 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-03-16 19:16:10 +0900
commit10d360847baf3394b7d9cd0dca6fa6908a2ce604 (patch)
treee002efb69ac76d6d34d47ff7d76f7c7d65c67339 /sample
parentefad0166c660d565d5e80e862cd9ff9457f8ed03 (diff)
[ruby/openssl] pkey: prefer PKey.read over PKey::RSA.new in docs
https://github.com/ruby/openssl/commit/cf92a3ffba
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4275
Diffstat (limited to 'sample')
-rw-r--r--sample/openssl/echo_cli.rb2
-rw-r--r--sample/openssl/echo_svr.rb2
-rw-r--r--sample/openssl/gen_csr.rb2
-rw-r--r--sample/openssl/smime_read.rb2
-rw-r--r--sample/openssl/smime_write.rb2
5 files changed, 5 insertions, 5 deletions
diff --git a/sample/openssl/echo_cli.rb b/sample/openssl/echo_cli.rb
index 069a21ec944..3fbadf33613 100644
--- a/sample/openssl/echo_cli.rb
+++ b/sample/openssl/echo_cli.rb
@@ -15,7 +15,7 @@ ca_path = options["C"]
ctx = OpenSSL::SSL::SSLContext.new()
if cert_file && key_file
ctx.cert = OpenSSL::X509::Certificate.new(File::read(cert_file))
- ctx.key = OpenSSL::PKey::RSA.new(File::read(key_file))
+ ctx.key = OpenSSL::PKey.read(File::read(key_file))
end
if ca_path
ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER
diff --git a/sample/openssl/echo_svr.rb b/sample/openssl/echo_svr.rb
index ba15394e6fb..1cc07b9b960 100644
--- a/sample/openssl/echo_svr.rb
+++ b/sample/openssl/echo_svr.rb
@@ -13,7 +13,7 @@ ca_path = options["C"]
if cert_file && key_file
cert = OpenSSL::X509::Certificate.new(File::read(cert_file))
- key = OpenSSL::PKey::RSA.new(File::read(key_file))
+ key = OpenSSL::PKey.read(File::read(key_file))
else
key = OpenSSL::PKey::RSA.new(512){ print "." }
puts
diff --git a/sample/openssl/gen_csr.rb b/sample/openssl/gen_csr.rb
index a061260cd79..2602b68a118 100644
--- a/sample/openssl/gen_csr.rb
+++ b/sample/openssl/gen_csr.rb
@@ -25,7 +25,7 @@ name = X509::Name.parse(name_str)
keypair = nil
if keypair_file
- keypair = PKey::RSA.new(File.open(keypair_file).read)
+ keypair = PKey.read(File.read(keypair_file))
else
keypair = PKey::RSA.new(1024) { putc "." }
puts
diff --git a/sample/openssl/smime_read.rb b/sample/openssl/smime_read.rb
index 17394f9b8d3..a70105fd61f 100644
--- a/sample/openssl/smime_read.rb
+++ b/sample/openssl/smime_read.rb
@@ -11,7 +11,7 @@ ca_path = options["C"]
data = $stdin.read
cert = X509::Certificate.new(File::read(cert_file))
-key = PKey::RSA.new(File::read(key_file))
+key = PKey::read(File::read(key_file))
p7enc = PKCS7::read_smime(data)
data = p7enc.decrypt(key, cert)
diff --git a/sample/openssl/smime_write.rb b/sample/openssl/smime_write.rb
index 5a5236c7507..20c933b288a 100644
--- a/sample/openssl/smime_write.rb
+++ b/sample/openssl/smime_write.rb
@@ -9,7 +9,7 @@ key_file = options["k"]
rcpt_file = options["r"]
cert = X509::Certificate.new(File::read(cert_file))
-key = PKey::RSA.new(File::read(key_file))
+key = PKey::read(File::read(key_file))
data = "Content-Type: text/plain\r\n"
data << "\r\n"