First commit

This commit is contained in:
2025-10-02 10:33:06 +08:00
parent 198b8bf2a6
commit c38eed4a22
5512 changed files with 958855 additions and 0 deletions

26
app/Common/Rsa2.php Executable file
View File

@@ -0,0 +1,26 @@
<?php
namespace app\Common;
class Rsa2
{
private $private_key;
private $public_key;
private $config = array(
"digest_alg" => "sha512",
"private_key_bits" =>2048,
"private_key_type" => OPENSSL_KEYTYPE_RSA
);
function __construct(){
$res = openssl_pkey_new($this->config);
//生成私钥
openssl_pkey_export($res, $this->private_key, null, $this->config);
//生成公钥
$this->public_key = openssl_pkey_get_details($res)['key'];
}
public function getKeys() {
$result = [];
if(!empty($this->private_key)) $result['private_key'] =$this->private_key;
if(!empty($this->public_key)) $result['public_key'] =$this->public_key;
return $result;
}
}