[英]How to make openssl_decrypt working in php 5
openssl_decrypt
is not working in PHP 5 . openssl_decrypt
在PHP 5中不起作用。 My server is PHP 5 and I cannot change its version.我的服务器是PHP 5 ,我无法更改其版本。 It uses many other functions and if I upgrade that won't work.
它使用许多其他功能,如果我升级将无法正常工作。 My local machine is PHP 7 and the
openssl_decrypt
is working there.我的本地机器是PHP 7并且
openssl_decrypt
在那里工作。
So how can I make working the openssl_decrypt
in PHP 5. Or any other alternative ways?那么我怎样才能在
openssl_decrypt
5 中使用 openssl_decrypt。或者任何其他替代方式?
Also a folder say ' newfolder ' in my server is PHP 7. Here openssl_decrypt
works.在我的服务器中还有一个说“ newfolder ”的文件夹是 PHP 7. 这里
openssl_decrypt
有效。 But I call the script(which uses openssl_decrypt
function) from any other location from my server it always return false.但是我从我的服务器的任何其他位置调用脚本(它使用
openssl_decrypt
函数)它总是返回 false。
EDIT编辑
PHP version of server is 5.3.28 PHP 服务器版本为5.3.28
Below is the code下面是代码
$decrypt_text = openssl_decrypt($encryptedtext, "AES-128-CTR", $encrypt_key, 0, '1010101010101010');
$decrypt_text
gives false
in php 5.3.28. $decrypt_text
在php 5.3.28中给出false
。
Got warning on error reporting.收到错误报告警告。
Warning: openssl_decrypt() [function.openssl-decrypt]: Unknown cipher algorithm警告:openssl_decrypt() [function.openssl-decrypt]:未知密码算法
But works in php 7.但适用于php 7。
So issue is something related to php version.所以问题与 php 版本有关。
The error is explaining that the cipher algorithm used AES-128-CTR
is unknown.该错误解释了使用
AES-128-CTR
的密码算法是未知的。 Check which cipher algorithms are available in that version of PHP using openssl_get_cipher_methods
.使用
openssl_get_cipher_methods
检查该版本的 PHP 中哪些密码算法可用。 https://www.php.net/manual/en/function.openssl-get-cipher-methods.php https://www.php.net/manual/en/function.openssl-get-cipher-methods.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.