diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-21 10:20:47 +0000 |
commit | 5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 () | |
tree | c63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/security/trust_dir.rb | |
parent | 2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff) |
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop https://.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/rubygems/security/trust_dir.rb | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -22,7 +22,7 @@ class Gem::Security::TrustDir # Creates a new TrustDir using +dir+ where the directory and file # permissions will be checked according to +permissions+ - def initialize dir, permissions = DEFAULT_PERMISSIONS @dir = dir @permissions = permissions @@ -32,7 +32,7 @@ class Gem::Security::TrustDir ## # Returns the path to the trusted +certificate+ - def cert_path certificate name_path certificate.subject end @@ -59,7 +59,7 @@ class Gem::Security::TrustDir # Returns the issuer certificate of the given +certificate+ if it exists in # the trust directory. - def issuer_of certificate path = name_path certificate.issuer return unless File.exist? path @@ -70,7 +70,7 @@ class Gem::Security::TrustDir ## # Returns the path to the trusted certificate with the given ASN.1 +name+ - def name_path name digest = @digester.hexdigest name.to_s File.join @dir, "cert-#{digest}.pem" @@ -79,7 +79,7 @@ class Gem::Security::TrustDir ## # Loads the given +certificate_file+ - def load_certificate certificate_file pem = File.read certificate_file OpenSSL::X509::Certificate.new pem @@ -88,7 +88,7 @@ class Gem::Security::TrustDir ## # Add a certificate to trusted certificate list. - def trust_cert certificate verify destination = cert_path certificate @@ -105,7 +105,7 @@ class Gem::Security::TrustDir # permissions. def verify - if File.exist? @dir then raise Gem::Security::Exception, "trust directory #{@dir} is not a directory" unless File.directory? @dir @@ -117,4 +117,3 @@ class Gem::Security::TrustDir end end - |