openssl extension implements public key encryption function

php中世界最好的语言
Release: 2023-03-22 07:48:01
Original
1961 people have browsed it

This time I will bring you the openssl extension to implement the public key encryption function. What are theprecautionsfor the openssl extension to implement the public key encryption function. The following is a practical case, let's take a look.

looks like this:

// 生成私钥 # openssl genrsa -out rsa_private_key.pem 1024 // 生成公钥 # openssl rsa -in rsa_private_key.pem -pubout -out rsa_public_key.pem
Copy after login

Here is the sample code:

'; // ------------------------------------------------------------ // 私钥解密 $encrypt_data = base64_decode($encrypt_data); openssl_private_decrypt($encrypt_data, $decrypt_data, $prikey); var_dump($decrypt_data);
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

phpStudy2018 installation tutorial

ThinkPHP implementation of WeChat payment (jsapi payment) process tutorial detailed explanation_php Example

The above is the detailed content of openssl extension implements public key encryption function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!