Home  >  Article  >  Backend Development  >  关于PHP公钥加密的有关问题

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

WBOY
WBOYOriginal
2016-06-13 13:21:551031browse

关于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在同一个目录?

换成绝对目录试一试
------解决方案--------------------
火狐下呢? 打开错误提示没有?
Statement:
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