~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to sample/openssl/gen_csr.rb

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-24 11:42:29 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20080124114229-jw2f87rdxlq6gp11
Tags: 1.9.0.0-2ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env ruby
2
2
 
3
 
require 'getopts'
 
3
require 'optparse'
4
4
require 'openssl'
5
5
 
6
6
include OpenSSL
14
14
  exit
15
15
end
16
16
 
17
 
getopts nil, "key:", "csrout:", "keyout:"
18
 
keypair_file = $OPT_key
19
 
csrout = $OPT_csrout || "csr.pem"
20
 
keyout = $OPT_keyout || "keypair.pem"
 
17
options = ARGV.getopts(nil, "key:", "csrout:", "keyout:")
 
18
keypair_file = options["key"]
 
19
csrout = options["csrout"] || "csr.pem"
 
20
keyout = options["keyout"] || "keypair.pem"
21
21
 
22
22
$stdout.sync = true
23
23
name_str = ARGV.shift or usage()
47
47
File.open(csrout, "w") do |f|
48
48
  f << req.to_pem
49
49
end
 
50
puts req.to_text
 
51
puts req.to_pem