instance method
Gem::Commands::CertCommand#open_private_key
open_private_key(key_file)
lib/rubygems/commands/cert_command.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/commands/cert_command.rb, line 95
def open_private_key(key_file)
check_openssl
passphrase = ENV["GEM_PRIVATE_KEY_PASSPHRASE"]
key = OpenSSL::PKey.read File.read(key_file), passphrase
raise Gem::OptionParser::InvalidArgument,
"#{key_file}: private key not found" unless key.private?
key
rescue Errno::ENOENT
raise Gem::OptionParser::InvalidArgument, "#{key_file}: does not exist"
rescue OpenSSL::PKey::PKeyError, ArgumentError
raise Gem::OptionParser::InvalidArgument, "#{key_file}: invalid RSA, DSA, or EC key"
end
No documentation available