Decrypts a string that is encrypted with the Encrypt function.
decrypt(string, key [, algorithm [, encoding] [, iv | salt [, iterations]]])
→ returns string
CFMX_COMPAT
algorithm, any combination of any number of characters; used as a seed used to generate a 32-bit encryption key.GenerateSecretKey
function to generate the key.
CFMX_COMPAT
encrypt
function for additional algorithms.CFMX_COMPAT
AES
BLOWFISH
DES
DESEDE
DESX
RC2
RC4
RC5
PBE
AES/GCM/NoPadding
UU
algorithm
parameter.
UU
Base64
Hex
SALT
.algorithm
parameter.
IV
.algorithm
parameter.
0
algorithm
parameter with a Password Based Encryption (PBE) algorithm.salt
parameter. Do not specify this parameter for Block Encryption Algorithms.iv
or salt
named parameters.
IVorSalt
parameter or aliases of iv
and salt
.
Generate an AES 128 bit key and then use it to encrypt and decrypt a secret.
ex={};
ex.key = generateSecretKey("AES");
ex.secret = "top secret";
ex.encrypted=encrypt(ex.secret, ex.key, "AES", "Base64");
ex.decrypted=decrypt(ex.encrypted, ex.key, "AES", "Base64");
writeDump(ex);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.