summaryrefslogtreecommitdiff
path: root/lib/rubygems/security.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-09 23:21:36 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-09 23:21:36 +0000
commit47f0248b0858898dd24d1e654cedf174059ca677 ()
tree493e84160f8609db408d88349f0624a3ff92c3c2 /lib/rubygems/security.rb
parentcd9f9e471977447a991ced4ea38efb2309459ef5 (diff)
* lib/rubygems: Import RubyGems 2.1
* test/rubygems: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rubygems/security.rb55
1 files changed, 32 insertions, 23 deletions
@@ -12,20 +12,6 @@ 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
##
@@ -352,17 +338,26 @@ module Gem::Security
##
# Digest algorithm used to sign gems
- DIGEST_ALGORITHM = OpenSSL::Digest::SHA1
##
# Used internally to select the signing digest from all computed digests
- DIGEST_NAME = DIGEST_ALGORITHM.new.name # :nodoc:
##
# Algorithm for creating the key pair used to sign gems
- KEY_ALGORITHM = OpenSSL::PKey::RSA
##
# Length of keys created by KEY_ALGORITHM
@@ -370,6 +365,12 @@ module Gem::Security
KEY_LENGTH = 2048
##
# One year in seconds
ONE_YEAR = 86400 * 365
@@ -563,13 +564,18 @@ module Gem::Security
##
# Writes +pemmable+, which must respond to +to_pem+ to +path+ with the given
- # +permissions+.
- def self.write pemmable, path, permissions = 0600
path = File.expand_path path
open path, 'wb', permissions do |io|
- io.write pemmable.to_pem
end
path
@@ -579,8 +585,11 @@ module Gem::Security
end
-require 'rubygems/security/policy'
-require 'rubygems/security/policies'
require 'rubygems/security/signer'
-require 'rubygems/security/trust_dir'