About the problem of PHP public key cryptography

Source: Internet
Author: User
Tags php editor
On the issue of PHP public key cryptography
I am going to use PHP's own SSL function to complete the cryptographic work of the public key. However, when accessing this test.php file, the Web page will always load, and IE will prompt the page not to display. Please look at the big God, is not my code is wrong, or what other problems. Because the PHP editor does not have an error, I suspect that it is my Apache server configuration problem.
The code is as follows:




Rsa


$source = "Test";
echo "

". $source."

";

$FP =fopen ("Ca.crt", "R");//ca.crt is X509 certificate file
$pub _key=fread ($fp, 8192);
Fclose ($FP);
Openssl_get_publickey ($pub _key);
Openssl_public_encrypt ($source, $crypttext, $pub _key);
echo "String crypted: $crypttext";
?>



------Solution--------------------
CA.CRT and test.php in the same directory?

Try the absolute catalogue.
------Solution--------------------
What about under Firefox? Did you open the error prompt?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.