我使用了 openssl_encrypt 和 openssl_decrypt 函数,但解密部分没有返回任何值,而使用相同的密钥 Encrypt 工作正常。这是我使用的功能。该变量$decrypted
始终返回 null 。每一个小小的帮助都将不胜感激
function deCryption($value)
{
$methods = openssl_get_cipher_methods();
$clefSecrete = "flight";
echo '<pre>';
foreach ($methods as $method) {
//$encrypted = openssl_encrypt($texteACrypter, $method, $clefSecrete); ----this was used for encryption
$decrypted = openssl_decrypt($value, $method, $clefSecrete);
echo "value=".$decrypted;
echo $method . ' : '. $decrypted . "\n";
break;
}
echo '</pre>';
return $decrypted;
}