【发布时间】:2018-08-02 03:28:36
【问题描述】:
下面的函数正确解密php5中的数据
function decrypt_mcrypt($key, $str) {
$str = base64_decode($str);
$iv = substr($str, 0, 16);
$str = substr($str, 16);
return mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $str, MCRYPT_MODE_CFB, $iv);
}
我尝试使用 openssl 而不是 mcrypt(在 php7 中),但输出有垃圾。
function decrypt_openssl($key, $str) {
$str = base64_decode($str);
$iv = substr($str, 0, 16);
$str = substr($str, 16);
return openssl_decrypt($str, 'AES-256-CFB', $key, OPENSSL_RAW_DATA, $iv);
}
可能是什么问题?
【问题讨论】:
标签: php encryption aes mcrypt php-openssl