安装插件
进入谷歌商店 https://chrome.google.com/webstore/search/Console%20Importer?hl=zh-CN 安装插件 Console Importer
使用
打开浏览器console控制台,通过$("包名")安装插件。如:CryptoJS 加密库
$i("CryptoJS")
importer.js:2 [$i]: Searching for CryptoJS, please be patient...
undefined
importer.js:2 [$i]: CryptoJS not found, import crypto-js instead.
importer.js:2 [$i]: crypto-js is loading, please be patient...
importer.js:2 [$i]: crypto-js(https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js) is loaded.
安装后使用
var query_str = "SELECT * FROM group LIMIT 50;"; let key = CryptoJS.enc.Utf8.parse('GftZqNE0BVdB2kwx'); let iv = CryptoJS.enc.Utf8.parse('3zyJFPEzh6rUeUNi'); // 加密方式使用CBC,padding偏移量设置成Pkcs7,以便和后端对应解密 let encryptData = CryptoJS.AES.encrypt(query_str, key, { mode: CryptoJS.mode.CBC, iv: iv, padding: CryptoJS.pad.Pkcs7 }); console.log(encryptData.toString()); kcHMyx/qHfKBUUaFDoAWFuS6IBevO2N8ZvfZowSQKuk=
后端PHP解析加密字符串 kcHMyx/qHfKBUUaFDoAWFuS6IBevO2N8ZvfZowSQKuk=
$encryptData = 'kcHMyx/qHfKBUUaFDoAWFuS6IBevO2N8ZvfZowSQKuk='; $cryptKey = 'GftZqNE0BVdB2kwx'; $iv = '3zyJFPEzh6rUeUNi'; $decryptData = openssl_decrypt($encryptData, 'AES-128-CBC', $cryptKey, 0, $iv);标签:插件,Console,Chrome,crypto,js,encryptData,CryptoJS,iv From: https://www.cnblogs.com/tinywan/p/17265835.html
解密后的 $decryptData : SELECT * FROM group LIMIT 50;