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