关于PHP公钥加密的有关问题

WBOY
Release: 2016-06-13 10:32:51
Original
1003 people have browsed it

关于PHP公钥加密的问题
我准备使用PHP自带的SSL函数完成公钥的加密工作。但是访问这个test.php文件时,网页会一直加载,然后IE会提示网页无法显示。请各位大神看看,是不是我代码写错,或者是其他什么问题。因为PHP编辑器没有报错,我怀疑是我的Apache服务器配置的问题。
代码如下:




RSA


$source="Test";
echo "

".$source."

";

$fp=fopen("ca.crt","r");//ca.crt是X509证书文件
$pub_key=fread($fp,8192);
fclose($fp);
openssl_get_publickey($pub_key);
openssl_public_encrypt($source,$crypttext,$pub_key);
echo "String crypted: $crypttext";
?>



------解决方案--------------------
ca.crt 和test.php在同一个目录?

换成绝对目录试一试
------解决方案--------------------
火狐下呢? 打开错误提示没有?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!