mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* sample/openssl/gen_csr.rb: there (at least) is a CA which does not accept DN
in UTF8STRING format. it's a sample. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ea03c3fc2c
commit
cc2343e7b7
2 changed files with 9 additions and 3 deletions
|
@ -25,11 +25,11 @@ $stdout.sync = true
|
|||
|
||||
name_ary = name_str.scan(/\s*([^\/,]+)\s*/).collect { |i| i[0].split("=") }
|
||||
p name_ary
|
||||
name = X509::Name.new(name_ary)
|
||||
name = X509::Name.new(name_ary, OpenSSL::ASN1::PRINTABLESTRING)
|
||||
|
||||
keypair = nil
|
||||
if keypair_file
|
||||
keypair = PKey::RSA.new(File.read(keypair_file))
|
||||
keypair = PKey::RSA.new(File.open(keypair_file).read)
|
||||
else
|
||||
keypair = PKey::RSA.new(1024) { putc "." }
|
||||
puts
|
||||
|
@ -42,9 +42,10 @@ end
|
|||
puts "Generating CSR for #{name_ary.inspect}"
|
||||
|
||||
req = X509::Request.new
|
||||
req.version = 0
|
||||
req.subject = name
|
||||
req.public_key = keypair.public_key
|
||||
req.sign(keypair, Digest::SHA1.new)
|
||||
req.sign(keypair, Digest::MD5.new)
|
||||
|
||||
puts "Writing #{csrout}..."
|
||||
File.open(csrout, "w") do |f|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue