美文网首页
php openssl使用

php openssl使用

作者: LeftJoin | 来源:发表于2018-03-09 11:52 被阅读0次
$r = openssl_pkey_new();  #创建一个新的私钥
openssl_pkey_export($r, $privKey); #生成私有钥
file_put_contents('./priv.key', $privKey);
$rp = openssl_pkey_get_details($r) ;#生成公钥
$pubKey = $rp['key'];
file_put_contents('./pub.key', $pubKey);;
$priv = openssl_pkey_get_private(file_get_contents('./priv.key')); //这个函数可用来判断私钥是否是可用的,可用返回资源id Resource id  
$pu_key = openssl_pkey_get_public(file_get_contents('./pub.key'));//这个函数可用来判断公钥是否是可用的  
windows 安装http://blog.csdn.net/kitok/article/details/72957185
找到配置文件 改名到phpinfo()函数指向的openssl目录
类库  https://github.com/china8036/RSA

https://my.oschina.net/janpoem/blog/803869

相关文章

网友评论

      本文标题:php openssl使用

      本文链接:https://www.haomeiwen.com/subject/nnspfftx.html