$openssl_cnf_path = 'openssl.cnf路徑';
$config = array(
'config'=> $openssl_cnf_path,
"digest_alg" => "sha512",
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
);
//創建私鑰和公鑰
$res = openssl_pkey_new($config);
//獲取私鑰
openssl_pkey_export($res, $privKey, null, $config);
//獲取公鑰
$pubKey = openssl_pkey_get_details($res);
$pubKey = $pubKey["key"];
PHP生成公鑰和私鑰
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章