Syntax
AES_ENCRYPT(text, key, [iv], [mode: "aead"], [expires_in])
Usage examples
Example 1
Formula | AES_ENCRYPT("hello world", CREDENTIAL.secret_key, mode: "aead", expires_in: 60) |
AES_ENCRYPT
Encrypts text using AES
The output is encoded with character set "[A-Za-z0-9+/=.]" (base64 + '.').
AES_ENCRYPT(text, key, [iv], [mode: "aead"], [expires_in])
text: The plaintext to be encrypted.
key: A 32 byte secret value to be used for encryption.
iv: A 16 byte value that must never be repeated. Note that when the "mode" is set to "aead" the iv is managed and does not need to be set.
mode: Determines how AES_ENCRYPT should behave, with the default mode being a very plain aes-256-cbc implementation and "aead" being an authenticated encryption mode designed to be safer and easier to use.
expires_in: An integer that defines the number of seconds before the ciphertext will be rejected by AES_DECRYPT, this is only available when the mode is set to "aead" and the expiration is enforced by AES_DECRYPT.