Module: JsonWebToken::Algorithm::Common
Constant Summary collapse
- SHA_BITS =
[ '256', '384', '512' ]
Instance Method Summary collapse
- #digest_new(sha_bits) ⇒ Object
- #validate_key(sha_bits, key) ⇒ Object
- #validate_sha_bits(sha_bits) ⇒ Object
Instance Method Details
#digest_new(sha_bits) ⇒ Object
22 23 24 |
# File 'lib/json_web_token/algorithm/common.rb', line 22 def digest_new(sha_bits) OpenSSL::Digest.new("sha#{sha_bits}") end |
#validate_key(sha_bits, key) ⇒ Object
13 14 15 16 |
# File 'lib/json_web_token/algorithm/common.rb', line 13 def validate_key(sha_bits, key) validate_sha_bits(sha_bits) validate_key_size(sha_bits, key) end |
#validate_sha_bits(sha_bits) ⇒ Object
18 19 20 |
# File 'lib/json_web_token/algorithm/common.rb', line 18 def validate_sha_bits(sha_bits) fail('Invalid sha_bits') unless SHA_BITS.include?(sha_bits) end |