PHP7.1 encryption function mcrypt_module_open ()

Source: Internet
Author: User
I upgraded php to 7.1 today and found that this function is not recommended: mcrypt_module_open () isdeprecated. Is there any other solution to replace it? Because 7.1 has not yet been officially released, and the 7.1 release document is not written above... I upgraded php to 7.1 today. it is found that this function is not recommended:
Mcrypt_module_open () is deprecated

Are there other solutions for replacement?

====================================

Because 7.1 has not yet been officially released, and the 7.1 release documentation has been written above and will not be implemented using mcrypt-like extensions, this issue is currently unsolved. If you encounter the same problem, use version 5 or 7.0.

Reply content:

I upgraded php to 7.1 today and found that this function is not recommended:
Mcrypt_module_open () is deprecated

Are there other solutions for replacement?

====================================

Because 7.1 has not yet been officially released, and the 7.1 release documentation has been written above and will not be implemented using mcrypt-like extensions, this issue is currently unsolved. If you encounter the same problem, use version 5 or 7.0.

I strongly disagree with @ eechen. who said it was not mentioned in the manual !?

Http://php.net/manual/zh/migr...

Original Reference Manual:

The mcrypt extension has expired for about 10 years and is very complex to use. Therefore, it is discarded and replaced by OpenSSL. From PHP 7.2, it will be removed from the core code and moved to PECL.

In PHP 7.1, you can also find and use the mycrypt extension in the PHP installation package, which will be removed in PHP 7.2. However, we can still download the extension from PECL to the source code, compile and install it.

However, we recommend that you follow the PHP advice and use OpenSSL to gradually replace the role played by mcrypt.

You can use asymmetric encryption! Public key encryption and private key decryption.

The mcrypt extension has been deprecated in 7.1, and will be migrated from built-in to PECL in 7.2.

If full compatibility is required, deprecated can only be ignored;
If you only need a substitute for similar functions, we recommend that you use OpenSSL extension.

For more information, see the official manual.

But the manual does notdeprecatedOf course, there is no alternative solution.
In addition, I am not prompted to use PHP 7.0 for running.
The last step is that the 7.1 version has not been officially released. you can regard it as a bug.

Supplement:
Thanks for reminding me that the PHP Manual provides an alternative solution on the 7.1 Migration page, that is, replacing MCrypt with OpenSSL.
The following describes how to use OpenSSL to implement symmetric encryption AES and asymmetric encryption RSA.

AES:
  RSA: use openssl to generate an rsa key pair (private key/public key): openssl genrsa-out rsa_private_key.pem 1024 openssl rsa-pubout-in rsa_private_key.pem-out rsa_public_key.pem
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.