Whatever message this page gives is out now! Go check it out!
DecryptBinary(input,key,[algorithm, prefix, iterations])Parameter | Description |
input | Binary data to decrypt. |
key | String. For the CFMX_COMPAT algorithm, the seed that was used to encrypt the binary data; for all other algorithms, the string generated by the generateSecretKey() method. |
algorithm | (Optional) The Enterprise Edition of ColdFusion installs the RSA BSafe Crypto-J library, which provides FIPS-140 Compliant Strong Cryptography. For a list of algorithms, see the Encrypt function.The Standard Edition of ColdFusion installs a cryptography library with the following algorithms:
|
prefix | (Optional) Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software. If you specify this parameter, also specify the algorithm parameter.
|
iterations | (Optional) The number of iterations to transform the password into a binary key. Specify this parameter to adjust ColdFusion encryption to match the details of other encryption software. If you specify this parameter, also specify the algorithm parameter with a Password Based Encryption (PBE) algorithm. Do not specify this parameter for Block Encryption Algorithms. Use the same value to encrypt and decrypt the data. |
<cfscript>
// binary data
b = ToBinary("abcd")
// generate the key
key = GenerateSecretKey("AES")
iterations="AssoicatedData"
randomIntegers = [];
// generate the SALT value
for ( i = 1 ; i <= 12 ; i++ ) {
arrayAppend( randomIntegers, randRange( -128, 127, "SHA1PRNG" ) );
}
initializationVector = javaCast( "byte[]", randomIntegers )
// encrypt binary
enc1 = EncryptBinary(binaryData=b,
key=key,
algorithm="AES/GCM/NoPadding",
IV_Salt=initializationVector,
iterations=iterations)
// decrypt binary
dec1=DecryptBinary(binaryData=enc1,
key=key,
algorithm="AES/GCM/NoPadding",
prefix=initializationVector,
iterations=iterations)
writeDump(dec1)
</cfscript>