json_web_token v0.2.10 JsonWebToken.Algorithm.Ecdsa

Sign or verify a JSON Web Signature (JWS) structure using EDCSA

see http://tools.ietf.org/html/rfc7518#section-3.4

Link to this section Summary

Functions

Named curve corresponding to sha_bits

Return a der-encoded digital signature, or Message Authentication Code (MAC)

Predicate to verify a der-encoded digital signature, or Message Authentication Code (MAC)

Link to this section Functions

Link to this function curve(sha_bits)

Named curve corresponding to sha_bits

Link to this function sign(sha_bits, private_key, signing_input)

Return a der-encoded digital signature, or Message Authentication Code (MAC)

Example

iex> {_, private_key} = EcdsaUtil.key_pair
...> der_encoded_mac = JsonWebToken.Algorithm.Ecdsa.sign(:sha256, private_key, "signing_input")
...> byte_size(der_encoded_mac) > 69
true
Link to this function verify?(mac, sha_bits, public_key, signing_input)

Predicate to verify a der-encoded digital signature, or Message Authentication Code (MAC)

Example

iex> {public_key, private_key} = JsonWebToken.Algorithm.EcdsaUtil.key_pair
...> mac = JsonWebToken.Algorithm.Ecdsa.sign(:sha256, private_key, "signing_input")
...> JsonWebToken.Algorithm.Ecdsa.verify?(mac, :sha256, public_key, "signing_input")
true