PHP code example of layman / laravel-envelope
1. Go to this page and download the library: Download layman/laravel-envelope library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
layman / laravel-envelope example snippets
use Layman\LaravelEnvelope\Facades\Envelope;
// 获取公钥(可用于客户端加密 AES 密钥)
Envelope::getPublicKey();
// 解密
Envelope::decrypt($encrypted = "公钥加密的AES密钥", $nonce = "AES加密的随机数", $data = "AES加密数据");
// 签名
Envelope::signature($data = ["签名数据数组"]);
// 客户端验证签名
Envelope::clientVerifySignature($data = ["验签数据数组"], $signature = "服务端签名");
// 客户端加密
Envelope::clientEncryptData($data = ["需加密数据数组"]);
bash
php artisan vendor:publish --provider="Layman\LaravelEnvelope\EnvelopeServiceProvider" --tag=config
bash
php artisan envelope:generate