In case your data needs to be encrypted/obfuscated for storing, you can use the ENCRYPT and DECRYPT functions to achieve this goal.
select ENCRYPT(<Column>)
select DECRYPT(<Column>)
Custom AES-128 Key Encryption
For added security, you can optionally provide your own AES-128 encryption key.
select ENCRYPT(<Column>, <AES-128 Key>)
select DECRYPT(<Column>, <AES-128 Key>)
AES-128 Key must be a Base64-encoded AES-128 key, which is exactly 16 bytes (128 bits) when decoded.
Example:
-
Keys must be Base64-encoded AES-128 keys (16 bytes when decoded)
-
AES encryption uses CBC or GCM mode
-
Use the same key for both encryption and decryption
-
Encrypted values are returned as Base64-encoded strings
-
Invalid key formats will cause an error