web stats
Mirth Community - View Single Post - CryptoJS
Thread: CryptoJS
View Single Post
  #16  
Old 10-14-2014, 07:43 AM
kpatel kpatel is offline
What's HL7?
 
Join Date: Oct 2014
Posts: 5
kpatel is on a distinguished road
Default

// Read Encryption from File
getPropertyGlobal('Test/TestFile','TestFile','Text');
var encrypted = String(globalMap.get('TestFile.Text'));

// Read key From File
getPropertyGlobal('Test/key/key','key','key');
var key = String(globalMap.get('key.key'));

// Read iv From File
getPropertyGlobal('Test/key/key','key','iv');
var iv = String(globalMap.get('key.iv'));


//Decryption
var decrypted = CryptoJS.AES.decrypt(encrypted, key, {
keySize: 128 / 8,
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});

logger.info('Decrypted Text : ' + decrypted.toString(CryptoJS.enc.Utf8)); // Read Text From Decryption
Reply With Quote