New OPENSSL_ENCRYPT
, OPENSSL_DECRYPT
, TINES_ENCRYPT
, and TINES_DECRYPT
functions are available.
The new OPENSSL_ENCRYPT
and OPENSSL_DECRYPT
functions are ideal if you need control over the underlying encryption algorithm, such as when decrypting data from external systems, or encrypting data that must be encrypted outside of Tines.
OPENSSL_ENCRYPT("plaintext", "aes-256-cbc", CREDENTIALS.your_secret)
OPENSSL_DECRYPT(event.encrypted, "aes-256-cbc", CREDENTIALS.your_secret, event.iv)
OPENSSL_ENCRYPT("plaintext", "aes-256-gcm", CREDENTIALS.your_secret, "additional authenticated data")
OPENSSL_DECRYPT(event.encrypted, "aes-256-gcm", CREDENTIALS.your_secret, event.iv, event.aad, event.auth_tag)
TINES_ENCRYPT
and TINES_DECRYPT
are ideal for when you're encrypting data in Tines and also decrypting the ciphertext inside of Tines, providing an easier UX, more safety, and additional features like expiration.
TINES_ENCRYPT("plaintext", CREDENTIAL.secret_key, expires_in: 60)
TINES_DECRYPT(event.encrypted, CREDENTIAL.secret_key)
With these changes we recommend migrating to either the OPENSSL_*
or TINES_*
functions from the AES_ENCRYPT
and AES_DECRYPT
functions as these new functions are easier to use, more powerful, and make it very difficult to do things in a way that isn't safe.
https://www.tines.com/docs/formulas/functions/openssl-encrypt/
https://www.tines.com/docs/formulas/functions/tines-encrypt/