Skip to content

Commit

Permalink
Only output prime information to $stderr if $VERBOSE (#88)
Browse files Browse the repository at this point in the history
This is currently done even in non-$VERBOSE mode.  My guess as to
the reason it is done is to give the user the impression that the
server is doing something and not frozen, but I still think there
should be a way to disable it.  If the $VERBOSE flag isn't a good
way to do that, let's offer some other way to do that.
  • Loading branch information
jeremyevans authored Jan 26, 2023
1 parent e457003 commit 6cb9bf6
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions lib/webrick/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,22 @@ module Utils
# the issuer +cn+ and a +comment+ to be stored in the certificate.

def create_self_signed_cert(bits, cn, comment)
rsa = OpenSSL::PKey::RSA.new(bits){|p, n|
case p
when 0; $stderr.putc "." # BN_generate_prime
when 1; $stderr.putc "+" # BN_generate_prime
when 2; $stderr.putc "*" # searching good prime,
# n = #of try,
# but also data from BN_generate_prime
when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q,
# but also data from BN_generate_prime
else; $stderr.putc "*" # BN_generate_prime
end
}
rsa = if $VERBOSE
OpenSSL::PKey::RSA.new(bits){|p, n|
case p
when 0; $stderr.putc "." # BN_generate_prime
when 1; $stderr.putc "+" # BN_generate_prime
when 2; $stderr.putc "*" # searching good prime,
# n = #of try,
# but also data from BN_generate_prime
when 3; $stderr.putc "\n" # found good prime, n==0 - p, n==1 - q,
# but also data from BN_generate_prime
else; $stderr.putc "*" # BN_generate_prime
end
}
else
OpenSSL::PKey::RSA.new(bits)
end
cert = OpenSSL::X509::Certificate.new
cert.version = 2
cert.serial = 1
Expand Down

0 comments on commit 6cb9bf6

Please sign in to comment.