-
支持公钥加密
-
支持私钥解密
- PHP 7.0+
I、下载 git clone https://github.com/php-so/Rsa.git
[root@test1 usr]# pwd
/usr
[root@test1 usr]# git clone https://github.com/php-so/Rsa.git
Cloning into 'Rsa'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 10 (delta 0), reused 4 (delta 0), pack-reused 0
Unpacking objects: 100% (10/10), done.
[root@test1 usr]# cd Rsa/
[root@test1 Rsa]# cp ./rsa.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/
[root@test1 Rsa]# vim /usr/local/php/etc/php.ini
最下面添加2行
[Rsa]
extension=rsa.so
记得重新 php-fpm
查看模块
php -m
[root@test1 Rsa]# pwd
/usr/Rsa
[root@test1 Rsa]# cd test
/usr/local/php/bin/php rsa-test.php
_ ____
_ __ | |__ _ __ | _ \ ___ __ _
| '_ \| '_ \| '_ \ | |_) / __|/ _` |
| |_) | | | | |_) | | _ <\__ \ (_| |
| .__/|_| |_| .__/ |_| \_\___/\__,_|
|_| |_|
string(29) "l love you! this is rsa test."
string(171) "YlrrEbSczaDzMDTbSrzNP3JHSt0Yo8HRcMh6n95SUOFXtusiRg1HpMi3MFam7wcGxTNR5vRFuAzSKn6FCS1oIEo3aFAbTHz15MDvUW027Q3OvweTGO5DSzYqmxZJdCRUDBFrsiWD77dKRmi/NInUya7pPrBEcOwt6yIcbfSKBv8"
string(29) "l love you! this is rsa test."