Whatever message this page gives is out now! Go check it out!
Parameter | Description |
algorithm | The encryption algorithm for which to generate the key. The following algorithms are available in both standard and enterprise versions:
The following algorithms are available only in enterprise versions. Note: For the workaround at the beginning of the document, the following algorithms are supported.
ColdFusion Enterprise registers JSAFE as the default crypto provider. JSAFE provides the additional algorithms. |
string | The string to be used for conversion. |
salt | A random salt. The standard recommends a salt length of at least 64 bits (8 characters). The salt needs to be generated using a pseudo-random number generator (e.g SHA1PRNG). |
iterations | The number of PBKDEF iterations to perform. The recommended value for iterations is 1000 or more. |
keysize | The key size in number of bits. |
<cfscript>
salt="A41n9t0Q";
password = "Password@123";
PBKDFalgorithm = "PBKDF2WithSHA512-224";
dataToEncrypt= "Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua";
encryptionAlgorithm = "AES";
derivedKey = GeneratePBKDFKey(PBKDFalgorithm ,password ,salt,4096,128);
writeOutput("Generated PBKDFKey (Base 64) : " & derivedKey);
encryptedData = encrypt(dataToEncrypt, derivedKey, encryptionAlgorithm, "BASE64");
writeoutput("Data After Encryption using PBKDF2: " & encryptedData);
</cfscript><cfscript>
salt="A41n9t0Q";
password = "Password@123";
PBKDFalgorithm = "PBKDF2WithSHA512-224";
derivedKey = GeneratePBKDFKey(PBKDFalgorithm ,password ,salt,4096,128);
decryptedData = decrypt(encryptedData, derivedKey, encryptionAlgorithm, "BASE64");
writeoutput("Data After Decryption using PBKDF2: " & decryptedData);
</cfscript>