Fields.AES (fields v2.7.1)
Encrypt values with AES in Galois/Counter Mode (GCM)
https://en.wikipedia.org/wiki/Galois/Counter_Mode
using a random Initialisation Vector for each encryption,
this makes "bruteforce" decryption much more difficult.
See encrypt/1
and decrypt/1
for more details.
Link to this section Summary
Functions
Decrypt a binary using GCM.
Encrypt Using AES Galois/Counter Mode (GCM)
https://en.wikipedia.org/wiki/Galois/Counter_Mode
Uses a random IV for each call, and prepends the IV and Tag to the
ciphertext. This means that encrypt/1
will never return the same ciphertext
for the same value. This makes "cracking" (bruteforce decryption) much harder!
Link to this section Functions
decrypt(ciphertext)
Specs
Decrypt a binary using GCM.
Parameters
encrypt(plaintext)
Specs
Encrypt Using AES Galois/Counter Mode (GCM)
https://en.wikipedia.org/wiki/Galois/Counter_Mode
Uses a random IV for each call, and prepends the IV and Tag to the
ciphertext. This means that encrypt/1
will never return the same ciphertext
for the same value. This makes "cracking" (bruteforce decryption) much harder!
Parameters
plaintext
: Accepts any data type as all values are converted to a String usingto_string
before encryption.key_id
: the index of the AES encryption key used to encrypt the ciphertextExamples
iex> Fields.AES.encrypt("tea") != Fields.AES.encrypt("tea") true iex> ciphertext = Fields.AES.encrypt(123) iex> is_binary(ciphertext) true