Parent

Methods

Class Index [+]

Quicksearch

Gem::Security::Signer

Basic OpenSSL-based package signing class.

Attributes

cert_chain[RW]
key[RW]

Public Class Methods

new(key, cert_chain) click to toggle source
     # 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

Public Instance Methods

sign(data) click to toggle source

Sign data with given digest algorithm

     # File lib/rubygems/security.rb, line 819
819:     def sign(data)
820:       @key.sign(@algo.new, data)
821:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.