summaryrefslogtreecommitdiff
path: root/sample/openssl/gen_csr.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-05 14:55:52 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-05 14:55:52 +0000
commitcc2343e7b7b8bb54e0d2fb5ed45abb6141230624 (patch)
tree32c5656edf55b9015747ba1e8704b8ed14e0b3f6 /sample/openssl/gen_csr.rb
parentea03c3fc2c0bfcf6351c3bce9496fd4607f4594a (diff)
* 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
Diffstat (limited to 'sample/openssl/gen_csr.rb')
-rw-r--r--sample/openssl/gen_csr.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/sample/openssl/gen_csr.rb b/sample/openssl/gen_csr.rb
index c22073b..5d6a654 100644
--- a/sample/openssl/gen_csr.rb
+++ b/sample/openssl/gen_csr.rb
@@ -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|