In my project (Titanium Appcelerator Android mobile App) I am using the CryptoJS library to encode with AES.
Although the first time that the CryptoJS.AES.encrypt is used it does not have any salt (i printed the salt of the encrypted variable and it says 'undefined'), all the others from this and on have random salts.
Here is some code:
var key53 = CryptoJS2.enc.Base64.parse("ASTRING");
var iv53 = CryptoJS2.enc.Base64.parse("ANOTHERSTRING");
var encrypted1 = CryptoJS2.AES.encrypt(String("test"), String(key53), {iv: String(iv53)});
var encrypted2 = CryptoJS2.AES.encrypt(String("test"), String(key53), {iv: String(iv53)});
/* other code here */
var encrypted3 = CryptoJS2.AES.encrypt(String("test"), String(key53), {iv: String(iv53)});
alert(encrypted1.salt); // undefined
alert(encrypted2.salt); // undefined
alert(encrypted3.salt); // some random salt
Then I am using Coldfusion to decrypt these encrypted values, just like this:
<cfset base64Key = "ASTRING">
<cfset base64IV = "ANOTHERSTRING">
<cfset ivBytes = binaryDecode(base64IV, "base64")>
#decrypt(variables.ename, base64Key, "AES/CBC/PKCS5Padding", "base64", ivBytes)#
When there is no salt involved, Coldfusion decrypts perfectly. However, when there is a salt, coldfusion throws this error:
An error occurred while trying to encrypt or decrypt your input string: Given final block not properly padded.
Thus, I would like my encryption to NOT involve any salt. Is this possible in CryptoJS? And if yes, HOW?
Thanks a million!