| 12345678910111213141516 | 
							- <?php
 
- namespace App\Service;
 
- class RsaEncryptionService extends Service
 
- {
 
-     public function encrypt($data)
 
-     {
 
-         //公钥文件位于 storage/app/public/rsa/public.pem
 
-         $publicKeyPath = storage_path('app/public/rsa/public.pem');
 
-         $publicKey = openssl_pkey_get_public(file_get_contents($publicKeyPath));
 
-         openssl_public_encrypt($data, $encrypted, $publicKey);
 
-         return base64_encode($encrypted);
 
-     }
 
- }
 
 
  |