Bug #69882 [NEW]: OpenSSL “key values mismatch” on SOAP HTTPS call mixed with openssl_pkcs12_read

From: Date: Fri, 19 Jun 2015 10:30:29 +0000
Subject: Bug #69882 [NEW]: OpenSSL “key values mismatch” on SOAP HTTPS call mixed with openssl_pkcs12_read
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193683@lists.php.net to get a copy of this message
From: falundir at gmail dot com Operating system: Debian 8.0 PHP version: 7.0.0alpha1 Package: SOAP related Bug Type: Bug Bug description:OpenSSL “key values mismatch” on SOAP HTTPS call mixed with openssl_pkcs12_read Description: ------------ Following scenario: 1. Call some SOAP method with HTTPS endpoint. 2. Call openssl_pkcs12_read on PKCS#12 file with extra certificates. 3. Call some SOAP method with HTTPS endpoint again. It will cause warning. Causes warning: Warning: SoapClient::__doRequest(): SSL operation failed with code 1. OpenSSL Error messages: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch followed by: Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers Versions affected are at least PHP 5.6.9 (Debian 8) and PHP 7.0.0-dev (tested on Rasmus's php7dev Vagrant box image from https://github.com/rlerdorf/php7dev.git). It worked OK in Debian 7 (PHP 5.4). More details and full working test case with certificate and public SOAP webservice available at http://stackoverflow.com/questions/30730846. Test script: --------------- $p12 = file_get_contents('certificate_with_private_key_and_extra_certs.p12'); $p12_password = 'password'; $sc = new SoapClient('URL to SOAP webservice with HTTPS endpoint'); var_dump($sc->method()); $result = openssl_pkcs12_read($p12, $cert_data, $p12_password); var_dump($sc->method()); //this causes warning and soap exception Expected result: ---------------- <var dumped result of $sc->method()> <var dumped result of $sc->method()> Actual result: -------------- <var dumped result of $sc->method()> Warning: SoapClient::__doRequest(): SSL operation failed with code 1. OpenSSL Error messages: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers -- Edit bug report at https://bugs.php.net/bug.php?id=69882&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69882&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69882&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69882&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69882&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69882&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69882&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69882&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69882&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69882&r=support Expected behavior: https://bugs.php.net/fix.php?id=69882&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69882&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69882&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69882&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69882&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69882&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69882&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69882&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69882&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69882&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69882&r=mysqlcfg

« previous php.bugs (#193683) next »