Conceal v0.1.1 Conceal View Source

Provides an easy way to encrypt and decrypt a string using the AES-CBC-256 algorithm.

It runs roughly this functions in order to return a encrypt base64-encoded string: base64(iv + aes_cbc256(sha256(key), iv, data))

Usage

key = "my_secret_key"
data = "my secret data"
digest = Conceal.encrypt(data, key)

case Conceal.decrypt(digest, key) do
  {:ok, decrypted_data} -> decrypted_data
  :error -> :error
end

Link to this section Summary

Functions

Decrypts the given digest string with the given key using AES-CBC-256.

Encrypts the given data string with the given key using AES-CBC-256.

Link to this section Functions

Decrypts the given digest string with the given key using AES-CBC-256.

Link to this function

encrypt(data, key)

View Source
encrypt(data :: String.t(), key :: String.t()) :: String.t()
encrypt(digest :: String.t(), key :: String.t()) :: {:ok, String.t()} | :error

Encrypts the given data string with the given key using AES-CBC-256.