js加密的密文让PHP解密(AES算法)
<script
src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/aes.js"></script>
<script
src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/md5.js"></script>
<script
src="http://crypto-js.googlecode.com/svn/tags/3.0.2/build/components/pad-zeropadding.js"></script>
<script>
var data =
"mysql_connect(‘111.111.111.111‘,‘root‘,‘111111‘)";
var key =
CryptoJS.enc.Latin1.parse(‘1111111111111111‘);
var iv =
CryptoJS.enc.Latin1.parse(‘1111111111111111‘);
var encrypted =
CryptoJS.AES.encrypt(data, key, { iv: iv, mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.ZeroPadding });
document.write(encrypted);
</script> |
<?php
$privateKey = "1111111111111111";
$iv =
"1111111111111111";
$encryptedData =
base64_decode("JLbb3T6NekoYFIcLeRZ45g7uiP3ojMdgSSUk3VKZgSvWVcCqqr/GaIv0mQ/hMvht
5YCM87tC3c9t05izRtsbZg==");
$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $privateKey,
$encryptedData, MCRYPT_MODE_CBC, $iv);
echo($decrypted);
?> |
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。