PHP错误:警告:openssl_decrypt():未知密码算法

时间:2018-07-02 11:24:50

标签: php encryption configuration openssl

运行此命令时:

<?php
openssl_decrypt('<string>', 'mcrypt_rijndael_256', '<key>', 0, '');
?>

我收到此错误:

Warning: openssl_decrypt(): Unknown cipher algorithm

我不确定我的VM是否已正确配置为处理“ mcrypt_rijndael_256”。我的phpinfo显示在mcrypt部分:

mcrypt
mcrypt support  enabled
mcrypt_filter support   enabled
Version     2.5.8
Api No  20021217
Supported ciphers   cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
Supported modes     cbc cfb ctr ecb ncfb nofb ofb stream 

我有PHP 7.2.7。我需要以某种方式将其添加到PHP吗?

1 个答案:

答案 0 :(得分:2)

您正在尝试在mcrypt's函数中使用openssl算法名称,因为 mcrypt openssl 是不同的扩展名,因此无法使用。另外,RIJNDAEL_256 openssl 中没有直接对应的内容。有关更多详细信息,请参见another question