Decrypt()
Decrypts a string that is encrypted with the Encrypt function.
Decrypt( encrypted_string=string, key=string, algorithm=string, encoding=string, IVorSalt=any, iterations=number, precise=boolean );
Returns: String
| Argument | Description | Default |
|---|---|---|
|
encrypted_string
string,
required
|
edit
String to decrypt. Alias: encryptedString, string |
|
|
key
string,
required
|
edit
Key or seed used to encrypt the string.
|
|
|
algorithm
string,
optional
|
edit
The algorithm to use to decrypt the string. Must be the same as the algorithm used to encrypt the string.
|
cfmx_compat |
|
encoding
string,
optional
|
edit
The binary encoding used to represent the data as a string. Must be the same as the algorithm used to encrypt the string.
|
uu |
|
IVorSalt
any,
optional
|
edit
Initialization Vector for algorithms with Feedback Mode that is not ECB, or Salt for Password Based Encryption algorithms Alias: IV, Salt |
|
|
iterations
number,
optional
|
edit
number of Iterations for Password Based Encryption algorithms (ignored for all other algorithms). NIST recommends a minimum value of 1000. |
|
|
precise
boolean,
optional
|
edit
if set to true the input must follow the rule for that encoding a 100%, the decryptor will not try to interpret inputs that are not a 100% correct. This should be used to avoid false positives. Introduced: 6.0.0.227 |
true |
Examples
editkey=generateSecretKey("BLOWFISH");
testEncrypt = encrypt("safe_our_tree",key,"BLOWFISH","base64");
testDecrypt = decrypt(testEncrypt,key,"BLOWFISH","base64");
writeDump(testDecrypt);
Related System Properties / Environment Variables
- LUCEE_ENCRYPTION_ALGORITHM - Default encryption algorithm used when none is specified. The default `cfmx_compat` is not cryptographically secure - strongly recommended to use `AES` instead. Valid values: `CFMX_COMPAT`, `AES`, `BLOWFISH`, `DES`
Type: string, Default: cfmx_compat
See also
- Cryptography
- Encryption/Decryption with RSA public and private keys
- Encrypt()
- GenerateRSAkeys()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)