简体   繁体   中英

PHP error: Warning: openssl_decrypt(): Unknown cipher algorithm

When I run this:

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

I get this error:

Warning: openssl_decrypt(): Unknown cipher algorithm

I'm not sure if my VM is configured correctly to handle "mcrypt_rijndael_256". My phpinfo shows in the mcrypt section:

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 

I have PHP 7.2.7. Do I need to add it to PHP somehow?

You are trying to use mcrypt's algorithm name in openssl functions, which won't work, because mcrypt and openssl are different extensions. Also RIJNDAEL_256 does not have a direct counterpart in openssl . See another question for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM