Sha256: 67ffb424441fc91c3a8b2f526d2337f947ee6acf13fb3aba99be263e9042b600
Contents?: true
Size: 700 Bytes
Versions: 1
Compression:
Stored size: 700 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) public_key.verify(OpenSSL::Digest.new(algorithm.sub('RS', 'sha')), signature, signing_input) rescue OpenSSL::PKey::PKeyError raise JWT::VerificationError, 'Signature verification raised' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jwt-2.7.1 | lib/jwt/algos/rsa.rb |