JsonWebToken.Algorithm.Ecdsa
Sign or verify a JSON Web Signature (JWS) structure using EDCSA
Summary↑
curve(sha_bits) | Named curve corresponding to sha_bits |
sign(sha_bits, private_key, signing_input) | Return a der-encoded digital signature, or Message Authentication Code (MAC) |
verify?(mac, sha_bits, public_key, signing_input) | Predicate to verify a der-encoded digital signature, or Message Authentication Code (MAC) |
Functions
Named curve corresponding to sha_bits
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
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