Bug #75643 [NEW]: openssl_public_encrypt generates openssl errors

From: Date: Wed, 06 Dec 2017 22:31:22 +0000
Subject: Bug #75643 [NEW]: openssl_public_encrypt generates openssl errors
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212982@lists.php.net to get a copy of this message
From: ross dot mitchell at gmail dot com Operating system: Linux Arch PHP version: 7.1.12 Package: OpenSSL related Bug Type: Bug Bug description:openssl_public_encrypt generates openssl errors Description: ------------ Calling openssl_public_encrypt causes an "error:0906D06C:PEM routines:PEM_read_bio:no start line" to be returned from openssl_error_string, even though the function passes and returns an encrypted string This has become apparent when using PDO with SSL, as the openssl_error_string drops the connection. I think some work was done on the in Bug #69524, however the issue still appears to be in place, at least for the openssl_public_encrypt function Test script: --------------- <?php $key = "-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLXp6PkCtbpV+P1gwFQWH6Ez0U 83uEmS8IGnpeI8Fk8rY/vHOZzZZaxRCw+loyc342qCDIQheMOCNm5Fkevz06q757 /oooiLR3yryYGKiKG1IZIiplmtsC95oKrzUSKk60wuI1mbgpMUP5LKi/Tvxes5Pm kUtXfimz2qgkeUcPpQIDAQAB -----END PUBLIC KEY-----"; $message = '123'; $passed = openssl_public_encrypt($message, $response, $key); echo (($passed) ? "Function Passed" : "Function Failed") . PHP_EOL; echo ((is_null($response)) ? "No Result Returned" : "Result Returned Successfully") . PHP_EOL; if ($error = openssl_error_string()) { echo "Error Returned: "; echo $error; } Expected result: ---------------- The script should either display Function Passed Result Returned or it should display Function Failed No Result Returned Error Returned: ${an openssl error string} Actual result: -------------- Function Passed Result Returned Successfully Error Returned: error:0906D06C:PEM routines:PEM_read_bio:no start line -- Edit bug report at https://bugs.php.net/bug.php?id=75643&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75643&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75643&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75643&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75643&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75643&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75643&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75643&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75643&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75643&r=support Expected behavior: https://bugs.php.net/fix.php?id=75643&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75643&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75643&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75643&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75643&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75643&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75643&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75643&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75643&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75643&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75643&r=mysqlcfg

« previous php.bugs (#212982) next »