CryptoJS は iv を 32 ビットとして暗号化し、php 復号化
<br /><script type="text/javascript" src='aes.js'></script><br /> <script type="text/javascript"><br /> var key = '123454536f667445454d537973576562';<br /> key = CryptoJS.enc.Hex.parse(key);<br /> var iv = CryptoJS.enc.Hex.parse("1234577290ABCDEF1264147890ACAE45");<br /> var encrypted = CryptoJS.AES.encrypt('T10515', key, {iv: iv,mode:CryptoJS.mode.CBC}).toString()<br /> alert(encrypted);<br /> </script><br />
<br /><?php<br />$pk = "123454536f667445454d537973576562";<br />$iv = "1234577290ABCDEF1264147890ACAE45";<br />$t = ('T10515');<br /><br />$encrypted = ( mcrypt_encrypt(MCRYPT_RIJNDAEL_128,$pk,$t,MCRYPT_MODE_CBC,$iv) );<br />echo 'base64_encode'.(base64_encode($encrypted)).'<br>';<br />?><br />
<br />Warning: mcrypt_encrypt(): Received initialization vector of size 32, but size 16 is required for this encryption mode in F:\LAMP\Apache2.4\htdocs\fee\cry.php on line 32<br />