在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
前端 使用key iv 使用aes加密后字符串传给后台 (可拼接时间戳加密) function js_encrypt(text){ var key = CryptoJS.enc.Latin1.parse('1E390CMD585LLS4S'); //为了避免补位,直接用16位的秘钥 var iv = CryptoJS.enc.Latin1.parse('1104432290129056'); //16位初始向量(请记住这两个都要保证是16位) var encrypted = CryptoJS.AES.encrypt(text, key, { iv: iv, mode:CryptoJS.mode.CBC, padding:CryptoJS.pad.ZeroPadding }); return encrypted; } 需引入js 文件下载 https://www.mdaima.com/upload_file/file/2019/07/04/1562201519633156.rar $password = input('password'); $password_dec=iconv('utf-8','gbk',js_decrypt_openssl($password)); $timesm=substr($password_dec,-10); $password = str_replace($timesm,'',$password_dec); if(time() > $timesm + 10){ $errcode = 10006; return json(['errcode'=>$errcode,'errmsg'=>errcode::getErrMsg($errcode)]); } function js_decrypt_openssl($encrypt){ $key = "****"; //与JS端的KEY一致 $iv = "****"; //这个也是要与JS中的IV一致 $decrypted = openssl_decrypt($encrypt, 'AES-128-CBC', $key, 2 , $iv); $decrypted = trim(trim($decrypted, "\0000"),'');//这个一定要有,要不然在你不用浏览器查看源代码的情况下是很难发现,还有一些乱码存在的 return $decrypted; }
|
2022-08-30
2022-08-17
2022-11-06
2022-08-18
2022-07-29
请发表评论