summaryrefslogtreecommitdiff
path: root/sample/openssl/gen_csr.rb
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 07:31:23 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-24 07:31:23 +0000
commita3bfedac36e946790c966c0319765479df770e4b (patch)
tree65a7e313612bef6245f1f0052308aace47e0da84 /sample/openssl/gen_csr.rb
parent8fd40444465a6165f08490269f8e0b142edc2824 (diff)
* sample/openssl: reviewed and remove dependency on getopts.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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