Hellom I've got strange and unexpected act of openssl_decrypt
<?php
$method = 'aes256';
$pass = 'sdaf879dsa8f7sdaf87sadf87';
$iv = 'asds9d87fsadf987';
$toEncrypt = array(
'data' => 'toEncrypt',
'time' => time(),
);
$toEncrypt = json_encode($toEncrypt);
echo $toEncrypt . PHP_EOL;
$encrypted = openssl_encrypt($toEncrypt, $method, $pass, false, $iv);
$decrypted = openssl_decrypt($encrypted, $method, $pass, false, $iv);
echo $decrypted . PHP_EOL;
as a return I got:
PHP5.6:
{"data":"toEncrypt","time":1487922033}
22033}":"toEncrypt","time":1487922033}
PHP7.0:
{"data":"toEncrypt","time":1487932229
{"data":"toEncrypt","time":1487932229}
In my opinion both strings should be the same as in PHP7:)
I am using Ubuntu 16.10 with php7.0 and additionaly php5.6 installed from ondrej/php repository. If php is switched to 7.0 everything is going ok, 5.6 causes problem with openssl_decrypt().
Any ideas Guys?