加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP中使用OpenSSL生成证书及加密解密

发布时间:2020-12-12 21:59:24 所属栏目:PHP教程 来源:网络整理
导读:依赖于OpenSSL扩展 "sha512","private_key_bits" => 4096,//字节数 512 1024 2048 4096 等 "private_key_type" => OPENSSL_KEYTYPE_RSA,//加密类型 ); $res = openssl_pkey_new($config); if($res == false) return false; openssl_pkey_export($res,$privat

依赖于OpenSSL扩展

"sha512","private_key_bits" => 4096,//字节数 512 1024 2048 4096 等 "private_key_type" => OPENSSL_KEYTYPE_RSA,//加密类型 ); $res = openssl_pkey_new($config); if($res == false) return false; openssl_pkey_export($res,$private_key); $public_key = openssl_pkey_get_details($res); $public_key = $public_key["key"]; file_put_contents(DATA_PATH."/conf/cert_public.key",$public_key); file_put_contents(DATA_PATH."/conf/cert_private.pem",$private_key); openssl_free_key($res); }

更多关于OpenSS的文章可以查看下面的相关文章

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读