method
new

v1_9_3_392 -
Show latest stable
-
0 notes -
Class: Signer
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (38)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
new(key, cert_chain)
public
Hide source
# File lib/rubygems/security.rb, line 791 def initialize(key, cert_chain) Gem.ensure_ssl_available @algo = Gem::Security::OPT[:dgst_algo] @key, @cert_chain = key, cert_chain # check key, if it's a file, and if it's key, leave it alone if @key && !@key.kind_of?(OpenSSL::PKey::PKey) @key = OpenSSL::PKey::RSA.new(File.read(@key)) end # check cert chain, if it's a file, load it, if it's cert data, convert # it into a cert object, and if it's a cert object, leave it alone if @cert_chain @cert_chain = @cert_chain.map do |cert| # check cert, if it's a file, load it, if it's cert data, convert it # into a cert object, and if it's a cert object, leave it alone if cert && !cert.kind_of?(OpenSSL::X509::Certificate) cert = File.read(cert) if File::exist?(cert) cert = OpenSSL::X509::Certificate.new(cert) end cert end end end