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
Link to this section Functions
@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.
Same as decrypt/2
but also accepts additional authenticated data (AAD).
@spec encrypt(Secrex.Cipher.plaintext(), Secrex.Cipher.key()) :: {:ok, Secrex.Cipher.ciphertext()}
Encrypts data using AES-256-GCM.
Same as encrypt/2
but also accepts additional authenticated data (AAD).