View Source Secrex.AES (Secrex v0.4.0)

This module is an implementation of Secrex.Cipher using AES-256-GCM.

example

Example

iex> encryption_key = "very-secretive"
iex> {:ok, encrypted} = Secrex.AES.encrypt("Hello, World!", encryption_key)
iex> Secrex.AES.decrypt(encrypted, encryption_key)
{:ok, "Hello, World!"}

Link to this section Summary

Functions

Decrypts data using AES-256-GCM.

Same as decrypt/2 but also accepts additional authenticated data (AAD).

Encrypts data using AES-256-GCM.

Same as encrypt/2 but also accepts additional authenticated data (AAD).

Link to this section Functions

Link to this function

decrypt(ciphertext, key)

View Source
@spec decrypt(Secrex.Cipher.ciphertext(), Secrex.Cipher.key()) ::
  {:ok, Secrex.Cipher.plaintext()}
  | {:error, :invalid_ciphertext | :incorrect_key_or_ciphertext}

Decrypts data using AES-256-GCM.

Link to this function

decrypt(ciphertext, key, aad)

View Source

Same as decrypt/2 but also accepts additional authenticated data (AAD).

Encrypts data using AES-256-GCM.

Link to this function

encrypt(plaintext, key, aad)

View Source

Same as encrypt/2 but also accepts additional authenticated data (AAD).