I use this lib to create AES encrypt string on Android and add this string to MySQL.
This is parameter of lib:
Now I want to decrypt the String by PHP:
This is encrypt string:
Plaintext: a
z8OVzJvtKHPCdT6PeFoEww==(encrypt)
Then I want decrypt this string on my webserver using PHP.
I use this code, but that have something wrong:
require "connect.php";
$sql_query = "SELECT * FROM user_info";
$result = mysqli_query($con,$sql_query);
$name_en="";
$row = mysqli_fetch_assoc($result);
$name_en = $row['name'];
echo $name_en;
$password = "123456789";
$iv = "0000000000000000";
echo "<br/>";
echo $password;
echo "<br/>";
$cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128,'','cbc','');
mcrypt_generic_init($cipher, $password, $iv);
$decrypted = mdecrypt_generic($cipher,base64_encode($name_en));
mcrypt_generic_deinit($cipher);
echo $decrypted;
But the result is:
z8OVzJvtKHPCdT6PeFoEww==
123456789
#�7��T26�r���v��u�T[|�9`��.���
Thank for advance.