0

I've placed javascript file in asset folder. How to call javascript function on click of button in activity. I need to show encrypted and decrypted text returned by js function in TextView so don't want to use webview. Please give me solution either for webview as well if its the only possibility.

Here is code for my js file

function encrypt(string, key, iv){
var key = CryptoJS.enc.Hex.parse(key);
var iv = CryptoJS.enc.Base64.parse(iv);
return CryptoJS.AES.encrypt(string, key, {
                            iv: iv,
                            mode: CryptoJS.mode.CBC
                            }).toString();}

function decrypt(string, key, iv){
var key = CryptoJS.enc.Hex.parse(key);
var iv = CryptoJS.enc.Base64.parse(iv);
return CryptoJS.AES.decrypt(string, key, {mode: CryptoJS.mode.CBC,  iv : iv}).toString(CryptoJS.enc.Utf8);}

Looking forward for solution, Thanks.

Tushar Baweja
  • 19
  • 1
  • 4
  • have a look into this https://stackoverflow.com/a/22418086/7835745 – Abdul Kawee Jul 30 '18 at 06:15
  • Note that the project suggested by that answer has been deprecated in favor of LiquidCore: https://github.com/LiquidPlayer/LiquidCore – nasch Jul 30 '18 at 21:45

0 Answers0