Module: JsonWebToken::Jwa
- Defined in:
- lib/json_web_token/jwa.rb
Overview
Choose a cryptographic algorithm to be used for a JSON Web Signature (JWS)
Constant Summary collapse
- ALGORITHMS =
/(HS|RS|ES)(256|384|512)?/i
- ALG_LENGTH =
5
Class Method Summary collapse
-
.sign(algorithm, key, signing_input) ⇒ BinaryString
A digital signature, or mac.
- .verify?(mac, algorithm, key, signing_input) ⇒ Boolean
Class Method Details
.sign(algorithm, key, signing_input) ⇒ BinaryString
Returns a digital signature, or mac.
24 25 26 27 |
# File 'lib/json_web_token/jwa.rb', line 24 def sign(algorithm, key, signing_input) alg_module, sha_bits = validated_alg(algorithm) alg_module.sign(sha_bits, key, signing_input) end |
.verify?(mac, algorithm, key, signing_input) ⇒ Boolean
38 39 40 41 |
# File 'lib/json_web_token/jwa.rb', line 38 def verify?(mac, algorithm, key, signing_input) alg_module, sha_bits = validated_alg(algorithm) alg_module.verify?(mac, sha_bits, key, signing_input) end |