HmCrypto v0.1.3 HmCrypto View Source

Main functional API of HmCrypto application. Provides signing and validation functionality.

Link to this section Summary

Functions

Returns list of availiable digest types

Generates base64-encoded signature of payload according given digest_type and private_key

Validates base64-encoded signature according given payload, digest_type and public_key. Returns true if signature is valid, else returns false

Link to this section Functions

Returns list of availiable digest types.

Examples

iex> HmCrypto.rsa_digest_types
  [:md5, :ripemd160, :sha, :sha224, :sha256, :sha384, :sha512]
Link to this function sign!(payload, digest_type, private_key) View Source

Generates base64-encoded signature of payload according given digest_type and private_key.

Usage

  signature = HmCrypto.sign!(payload, :sha512, priv_key)
  "XE54doOCtx+z2h9gILOHPKP8+RTnvQVAPUoKpux2PLZUBX2JVIaS3vNewQM6IpxvMzfewWm1H6j+SPbhhGpvcp3MiGo8426KlGoqg6jjuILAQ4jXzYrTa6HFBXhuk+Y34e0Hv1FKwbmVYXvn5RTmgYfI6vzA4spOoG/AMIis6hpnNE5lTsjHU76QtcVWJPfJKk2wDiZI9u2EWLGEq1BJuCfbZYSueNVe2aDqbZ7UANybyZsSHa1oPY6nP+FS5wm3zrKEdMV2PBGi63STg4WabBaaaB6s73GAA0IVogcysVtGKJ8vN17ion5zT6+r62DEHNGNGscjV7HTJd1tNNG9Iw=="
Link to this function valid?(payload, encoded_signature, digest_type, public_key) View Source

Validates base64-encoded signature according given payload, digest_type and public_key. Returns true if signature is valid, else returns false.

Usage

  HmCrypto.valid?(payload, signature, :sha512, public_key)
  true