PHP error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length

时间:2018-09-19 08:28:18

标签: php openssl php-openssl

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?

0 个答案:

没有答案