File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env ruby
22
33require 'openssl'
4- require 'digest/md5'
54
65class CHashDir
76 include Enumerable
@@ -161,7 +160,7 @@ def hash_name(name)
161160 end
162161
163162 def fingerprint ( der )
164- Digest . hexdigest ( 'MD5' , der ) . upcase
163+ OpenSSL :: Digest . hexdigest ( 'MD5' , der ) . upcase
165164 end
166165end
167166
Original file line number Diff line number Diff line change 1515 cert = OpenSSL ::X509 ::Certificate . new ( File ::read ( cert_file ) )
1616 key = OpenSSL ::PKey . read ( File ::read ( key_file ) )
1717else
18- key = OpenSSL ::PKey ::RSA . new ( 512 ) { print "." }
18+ key = OpenSSL ::PKey ::RSA . new ( 2048 ) { print "." }
1919 puts
2020 cert = OpenSSL ::X509 ::Certificate . new
2121 cert . version = 2
2525 cert . issuer = name
2626 cert . not_before = Time . now
2727 cert . not_after = Time . now + 3600
28- cert . public_key = key . public_key
28+ cert . public_key = key
2929 ef = OpenSSL ::X509 ::ExtensionFactory . new ( nil , cert )
3030 cert . extensions = [
3131 ef . create_extension ( "basicConstraints" , "CA:FALSE" ) ,
3737 ef . issuer_certificate = cert
3838 cert . add_extension ef . create_extension ( "authorityKeyIdentifier" ,
3939 "keyid:always,issuer:always" )
40- cert . sign ( key , OpenSSL :: Digest . new ( ' SHA1' ) )
40+ cert . sign ( key , " SHA1" )
4141end
4242
4343ctx = OpenSSL ::SSL ::SSLContext . new ( )
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def usage
2525if keypair_file
2626 keypair = OpenSSL ::PKey . read ( File . read ( keypair_file ) )
2727else
28- keypair = OpenSSL ::PKey ::RSA . new ( 1024 ) { putc "." }
28+ keypair = OpenSSL ::PKey ::RSA . new ( 2048 ) { putc "." }
2929 puts
3030 puts "Writing #{ keyout } ..."
3131 File . open ( keyout , "w" , 0400 ) do |f |
@@ -38,8 +38,8 @@ def usage
3838req = OpenSSL ::X509 ::Request . new
3939req . version = 0
4040req . subject = name
41- req . public_key = keypair . public_key
42- req . sign ( keypair , Digest . new ( ' MD5' ) )
41+ req . public_key = keypair
42+ req . sign ( keypair , " MD5" )
4343
4444puts "Writing #{ csrout } ..."
4545File . open ( csrout , "w" ) do |f |
You can’t perform that action at this time.
0 commit comments