module JWT::Algos::Rsa

Constants

SUPPORTED

Public Instance Methods

sign(algorithm, msg, key) click to toggle source
# File lib/jwt/algos/rsa.rb, line 10
def sign(algorithm, msg, key)
  raise EncodeError, "The given key is a #{key.class}. It has to be an OpenSSL::PKey::RSA instance." if key.instance_of?(String)

  key.sign(OpenSSL::Digest.new(algorithm.sub('RS', 'sha')), msg)
end
verify(algorithm, public_key, signing_input, signature) click to toggle source
# File lib/jwt/algos/rsa.rb, line 16
def verify(algorithm, public_key, signing_input, signature)
  SecurityUtils.verify_rsa(algorithm, public_key, signing_input, signature)
end