Sha256: 7aebdd015e7e91af2f3d838347368ec3ebfaf6b4cced430d96427512bf621019

Contents?: true

Size: 573 Bytes

Versions: 3

Compression:

Stored size: 573 Bytes

Contents

# frozen_string_literal: true

module JWT
  module Algos
    module Rsa
      module_function

      SUPPORTED = %w[RS256 RS384 RS512].freeze

      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

      def verify(algorithm, public_key, signing_input, signature)
        SecurityUtils.verify_rsa(algorithm, public_key, signing_input, signature)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fluent-plugin-google-cloud-logging-on-prem-0.1.0 vendor/ruby/3.1.0/gems/jwt-2.7.0/lib/jwt/algos/rsa.rb
jwt-2.7.0 lib/jwt/algos/rsa.rb
jwt-2.6.0 lib/jwt/algos/rsa.rb