I need to do triple DES encryption in GWT client file and need to do decryption of encrypted string in javascript. I have used TripleDesCipher in GWT but while doing decryption in javascript using crypto-js, I am getting blank string. Following is my GWT code.
TripleDesCipher cipher = new TripleDesCipher();
String enc ="";
String key = "579D2D852F2F3BABABBD71B7";
cipher.setKey(key.getBytes());
try {
enc = cipher.encrypt(String.valueOf(value));
} catch (DataLengthException e1) {
e1.printStackTrace();
} catch (IllegalStateException e1) {
e1.printStackTrace();
} catch (InvalidCipherTextException e1) {
e1.printStackTrace();
}
Following is my javascript code for decryption.
var encrypted = urlParams.get('id');
var base64String = encrypted.toString();
alert(base64String);
var key = "579D2D852F2F3BABABBD71B";
var decrypted =
CryptoJS.TripleDES.decrypt(base64String,key);
console.log("DES3 decrypted text:"+ decrypted.toString(CryptoJS.enc.Utf8));