Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Gem::Security.digest_required?
digest_required?(key)
lib/rubygems/security.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/security.rb, line 548
def self.digest_required?(key)
case key
when OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, OpenSSL::PKey::EC
true
else
return false if ml_dsa_key?(key)
raise Gem::Security::Exception,
"unsupported key algorithm. RSA, DSA, EC, ML-DSA-44, ML-DSA-65, and "\
"ML-DSA-87 keys are supported."
end
end
Returns whether the key requires an explicit digest algorithm for signing and verification. ML-DSA has a built-in digest and does not accept one. Any other algorithm raises, since a gem carries no record of how its signature was produced and RubyGems must not guess.