Parent

Methods

Class Index [+]

Quicksearch

Gem::Security::Signer

Basic OpenSSL-based package signing class.

Attributes

key[RW]
cert_chain[RW]

Public Class Methods

new(key, cert_chain) click to toggle source
     # File lib/rubygems/security.rb, line 752
752:     def initialize(key, cert_chain)
753:       Gem.ensure_ssl_available
754:       @algo = Gem::Security::OPT[:dgst_algo]
755:       @key, @cert_chain = key, cert_chain
756: 
757:       # check key, if it's a file, and if it's key, leave it alone
758:       if @key && !@key.kind_of?(OpenSSL::PKey::PKey)
759:         @key = OpenSSL::PKey::RSA.new(File.read(@key))
760:       end
761: 
762:       # check cert chain, if it's a file, load it, if it's cert data, convert
763:       # it into a cert object, and if it's a cert object, leave it alone
764:       if @cert_chain
765:         @cert_chain = @cert_chain.map do |cert|
766:           # check cert, if it's a file, load it, if it's cert data, convert it
767:           # into a cert object, and if it's a cert object, leave it alone
768:           if cert && !cert.kind_of?(OpenSSL::X509::Certificate)
769:             cert = File.read(cert) if File::exist?(cert)
770:             cert = OpenSSL::X509::Certificate.new(cert)
771:           end
772:           cert
773:         end
774:       end
775:     end

Public Instance Methods

sign(data) click to toggle source

Sign data with given digest algorithm

     # File lib/rubygems/security.rb, line 780
780:     def sign(data)
781:       @key.sign(@algo.new, data)
782:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.