json_web_token v0.2.10 JsonWebToken.Algorithm.Rsa
Sign or verify a JSON Web Signature (JWS) structure using RSASSA-PKCS-v1_5
see http://tools.ietf.org/html/rfc7518#section-3.3
Link to this section Summary
Functions
RSA key modulus, n
Return a Message Authentication Code (MAC)
Predicate to verify a digital signature, or mac
Link to this section Functions
Link to this function
modulus(list)
RSA key modulus, n
Link to this function
sign(sha_bits, private_key, signing_input)
Return a Message Authentication Code (MAC)
Example
iex> alias JsonWebToken.Algorithm.RsaUtil
...> private_key = RsaUtil.private_key("test/fixtures/rsa", "private_key.pem")
...> mac = JsonWebToken.Algorithm.Rsa.sign(:sha256, private_key, "signing_input")
...> byte_size(mac)
256
Link to this function
verify?(mac, sha_bits, public_key, signing_input)
Predicate to verify a digital signature, or mac
Example
iex> alias JsonWebToken.Algorithm.RsaUtil
...> path_to_keys = "test/fixtures/rsa"
...> private_key = RsaUtil.private_key(path_to_keys, "private_key.pem")
...> public_key = RsaUtil.public_key(path_to_keys, "public_key.pem")
...> mac = JsonWebToken.Algorithm.Rsa.sign(:sha256, private_key, "signing_input")
...> JsonWebToken.Algorithm.Rsa.verify?(mac, :sha256, public_key, "signing_input")
true