Class | Gem::Security::Signer |
In: |
lib/rubygems/security.rb
|
Parent: | Object |
cert_chain | [RW] | |
key | [RW] |
# File lib/rubygems/security.rb, line 790 790: def initialize(key, cert_chain) 791: Gem.ensure_ssl_available 792: @algo = Gem::Security::OPT[:dgst_algo] 793: @key, @cert_chain = key, cert_chain 794: 795: # check key, if it's a file, and if it's key, leave it alone 796: if @key && !@key.kind_of?(OpenSSL::PKey::PKey) 797: @key = OpenSSL::PKey::RSA.new(File.read(@key)) 798: end 799: 800: # check cert chain, if it's a file, load it, if it's cert data, convert 801: # it into a cert object, and if it's a cert object, leave it alone 802: if @cert_chain 803: @cert_chain = @cert_chain.map do |cert| 804: # check cert, if it's a file, load it, if it's cert data, convert it 805: # into a cert object, and if it's a cert object, leave it alone 806: if cert && !cert.kind_of?(OpenSSL::X509::Certificate) 807: cert = File.read(cert) if File::exist?(cert) 808: cert = OpenSSL::X509::Certificate.new(cert) 809: end 810: cert 811: end 812: end 813: end