summaryrefslogtreecommitdiff
path: root/lib/rubygems/security/signer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/security/signer.rb')
-rw-r--r--lib/rubygems/security/signer.rb15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
index cca82f1cf8..5732fb57fd 100644
--- a/lib/rubygems/security/signer.rb
+++ b/lib/rubygems/security/signer.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
##
# Basic OpenSSL-based package signing class.
@@ -105,7 +106,7 @@ class Gem::Security::Signer
# this value is preferred, otherwise the subject is used.
def extract_name(cert) # :nodoc:
- subject_alt_name = cert.extensions.find {|e| "subjectAltName" == e.oid }
+ subject_alt_name = cert.extensions.find {|e| e.oid == "subjectAltName" }
if subject_alt_name
/\Aemail:/ =~ subject_alt_name.value # rubocop:disable Performance/StartWith
@@ -174,10 +175,18 @@ class Gem::Security::Signer
old_cert = @cert_chain.last
disk_cert_path = File.join(Gem.default_cert_path)
- disk_cert = File.read(disk_cert_path) rescue nil
+ disk_cert = begin
+ File.read(disk_cert_path)
+ rescue StandardError
+ nil
+ end
disk_key_path = File.join(Gem.default_key_path)
- disk_key = OpenSSL::PKey.read(File.read(disk_key_path), @passphrase) rescue nil
+ disk_key = begin
+ OpenSSL::PKey.read(File.read(disk_key_path), @passphrase)
+ rescue StandardError
+ nil
+ end
return unless disk_key