diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 19:58:57 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 19:58:57 +0000 |
commit | 1daa0b113d853bfa57b776cc569939b61ca14292 (patch) | |
tree | f8c4acb08a551820299dff2b13966d6ac38d31e4 /lib/rubygems/security.rb | |
parent | 85995e88d49c442b5b113c2676456133e79f5c02 (diff) | |
download | ruby-1daa0b113d853bfa57b776cc569939b61ca14292.tar.gz |
* lib/rubygems: Update to RubyGems 2.1.3
Fixed installing platform gems
Restored concurrent requires
Fixed installing gems with extensions with --install-dir
Fixed `gem fetch -v` to install the latest version
Fixed installing gems with "./" in their files entries
* test/rubygems/test_gem_package.rb: Tests for the above.
* NEWS: Updated for RubyGems 2.1.3
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/security.rb')
-rw-r--r-- | lib/rubygems/security.rb | 55 |
1 files changed, 23 insertions, 32 deletions
diff --git a/lib/rubygems/security.rb b/lib/rubygems/security.rb index bfd6fd225b..bed47ab9f3 100644 --- a/lib/rubygems/security.rb +++ b/lib/rubygems/security.rb @@ -12,6 +12,20 @@ begin rescue LoadError => e raise unless (e.respond_to?(:path) && e.path == 'openssl') || e.message =~ / -- openssl$/ + + module OpenSSL # :nodoc: + class Digest # :nodoc: + class SHA1 # :nodoc: + def name + 'SHA1' + end + end + end + module PKey # :nodoc: + class RSA # :nodoc: + end + end + end end ## @@ -338,26 +352,17 @@ module Gem::Security ## # Digest algorithm used to sign gems - DIGEST_ALGORITHM = - if defined?(OpenSSL::Digest) then - OpenSSL::Digest::SHA1 - end + DIGEST_ALGORITHM = OpenSSL::Digest::SHA1 ## # Used internally to select the signing digest from all computed digests - DIGEST_NAME = # :nodoc: - if DIGEST_ALGORITHM then - DIGEST_ALGORITHM.new.name - end + DIGEST_NAME = DIGEST_ALGORITHM.new.name # :nodoc: ## # Algorithm for creating the key pair used to sign gems - KEY_ALGORITHM = - if defined?(OpenSSL::PKey) then - OpenSSL::PKey::RSA - end + KEY_ALGORITHM = OpenSSL::PKey::RSA ## # Length of keys created by KEY_ALGORITHM @@ -365,12 +370,6 @@ module Gem::Security KEY_LENGTH = 2048 ## - # Cipher used to encrypt the key pair used to sign gems. - # Must be in the list returned by OpenSSL::Cipher.ciphers - - KEY_CIPHER = OpenSSL::Cipher.new('AES-256-CBC') if defined?(OpenSSL::Cipher) - - ## # One year in seconds ONE_YEAR = 86400 * 365 @@ -564,18 +563,13 @@ module Gem::Security ## # Writes +pemmable+, which must respond to +to_pem+ to +path+ with the given - # +permissions+. If passed +cipher+ and +passphrase+ those arguments will be - # passed to +to_pem+. + # +permissions+. - def self.write pemmable, path, permissions = 0600, passphrase = nil, cipher = KEY_CIPHER + def self.write pemmable, path, permissions = 0600 path = File.expand_path path open path, 'wb', permissions do |io| - if passphrase and cipher - io.write pemmable.to_pem cipher, passphrase - else - io.write pemmable.to_pem - end + io.write pemmable.to_pem end path @@ -585,11 +579,8 @@ module Gem::Security end -if defined?(OpenSSL::SSL) then - require 'rubygems/security/policy' - require 'rubygems/security/policies' - require 'rubygems/security/trust_dir' -end - +require 'rubygems/security/policy' +require 'rubygems/security/policies' require 'rubygems/security/signer' +require 'rubygems/security/trust_dir' |