Module: JsonWebToken::Algorithm::Rsa

Extended by:
Common
Defined in:
lib/json_web_token/algorithm/rsa.rb

Constant Summary collapse

KEY_BITS_MIN =
2048

Constants included from Common

Common::SHA_BITS

Class Method Summary collapse

Methods included from Common

digest_new, validate_key, validate_sha_bits

Class Method Details

.signed(sha_bits, key, data) ⇒ Object



13
14
15
16
# File 'lib/json_web_token/algorithm/rsa.rb', line 13

def signed(sha_bits, key, data)
  validate_key(key, sha_bits)
  key.sign(digest_new(sha_bits), data)
end

.verified?(signature, sha_bits, key, data) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/json_web_token/algorithm/rsa.rb', line 18

def verified?(signature, sha_bits, key, data)
  validate_key(key, sha_bits)
  key.verify(digest_new(sha_bits), signature, data)
end