Openssl_get_publickey () operation results in PHP7 and php5.6 are not the same????

Source: Internet
Author: User
Hi everyone,

Today I meet a strange problem while the function Openssl_get_publickey () runs well in PHP 7 and report an error in PHP5 . 6.16 and php5.5.12

Here is the test code:
<?php

Define a PEM formatted string varaible named $key
$key = <<<eof
-----BEGIN Public KEY-----
migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcnxj/9qwvfgouh/ y2w89l6bkrafljhnhgpdypubv64bfqnn1pjbczkim6qrdkbolpxmkkmifynkd6raoprih3/prqeb/vsw8oom8fxn67udyuybtqa23mml9q1+ Ilizwbc2aq2ubvorfxffl75p6/b5ksing9zpgmlcuyulkxplqidaqab
-----END Public KEY-----
EOF;

Get the public key
$res = Openssl_get_publickey ($key);
Var_dump ($res);

?>

While in php7.0.0 the result is normal and correct the output
{

D:\wamp64\www\php\index.php (): eval () ' D code:24:resource (4, OpenSSL key)

}

But isn't the same result in PHP 5.6.16 and PHP 5.5.12 This is the output
{

D:\wamp64\www\php\index.php (): eval () ' d Code:24:boolean false

}

So can I help me with the problem???

Reply content:

Hi everyone,

Today I meet a strange problem while the function Openssl_get_publickey () runs well in PHP 7 and report an error in PHP5 . 6.16 and php5.5.12

Here is the test code:
<?php

Define a PEM formatted string varaible named $key
$key = <<<eof
-----BEGIN Public KEY-----
migfma0gcsqgsib3dqebaquaa4gnadcbiqkbgqcnxj/9qwvfgouh/ y2w89l6bkrafljhnhgpdypubv64bfqnn1pjbczkim6qrdkbolpxmkkmifynkd6raoprih3/prqeb/vsw8oom8fxn67udyuybtqa23mml9q1+ Ilizwbc2aq2ubvorfxffl75p6/b5ksing9zpgmlcuyulkxplqidaqab
-----END Public KEY-----
EOF;

Get the public key
$res = Openssl_get_publickey ($key);
Var_dump ($res);

?>

While in php7.0.0 the result is normal and correct the output
{

D:\wamp64\www\php\index.php (): eval () ' D code:24:resource (4, OpenSSL key)

}

But isn't the same result in PHP 5.6.16 and PHP 5.5.12 This is the output
{

D:\wamp64\www\php\index.php (): eval () ' d Code:24:boolean false

}

So can I help me with the problem???

  • 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.