I am decrypting an openssl encrypted data as follow:
$encrypted = 'my data';
$cipher = 'AES-256-CBC';
$key = 'my key';
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($cipher));
$decrypted = openssl_decrypt($encrypted, $cipher, $key, 0, $iv);
if(false === $decrypted)
{
echo openssl_error_string();
die;
}else{
echo $decrypted;
}
But when i am running the script in PHPi get following error:
error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
do you have any experience in this regards?