summaryrefslogtreecommitdiff
path: root/sample/openssl/gen_csr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/openssl/gen_csr.rb')
-rw-r--r--sample/openssl/gen_csr.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/sample/openssl/gen_csr.rb b/sample/openssl/gen_csr.rb
index d3da5741bc..4228707fdb 100644
--- a/sample/openssl/gen_csr.rb
+++ b/sample/openssl/gen_csr.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-require 'getopts'
+require 'optparse'
require 'openssl'
include OpenSSL
@@ -14,10 +14,10 @@ EOS
exit
end
-getopts nil, "key:", "csrout:", "keyout:"
-keypair_file = $OPT_key
-csrout = $OPT_csrout || "csr.pem"
-keyout = $OPT_keyout || "keypair.pem"
+options = ARGV.getopts(nil, "key:", "csrout:", "keyout:")
+keypair_file = options["key"]
+csrout = options["csrout"] || "csr.pem"
+keyout = options["keyout"] || "keypair.pem"
$stdout.sync = true
name_str = ARGV.shift or usage()
@@ -47,3 +47,5 @@ puts "Writing #{csrout}..."
File.open(csrout, "w") do |f|
f << req.to_pem
end
+puts req.to_text
+puts req.to_pem