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

From: Date: Sun, 21 Jun 2015 20:16:58 +0000
Subject: Bug #69882 [Opn]: OpenSSL “key values mismatch” on SOAP HTTPS mixed with openssl_pkcs12_read
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193744@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69882&edit=1 ID: 69882 User updated by: falundir at gmail dot com Reported by: falundir at gmail dot com Summary: OpenSSL “key values mismatch” on SOAP HTTPS mixed with openssl_pkcs12_read Status: Open Type: Bug Package: SOAP related Operating System: Debian 8.0 -PHP Version: 5.6.9 +PHP Version: 5.6.7 Block user comment: N Private report: N New Comment: Verified that PHP 5.6.7 is the first version with this bug. Tested by compiling from the source, so it's not a problem in Debian packaged version. Previous Comments: ------------------------------------------------------------------------ [2015-06-19 10:31:32] falundir at gmail dot com Fixed summary. ------------------------------------------------------------------------ [2015-06-19 10:30:28] falundir at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=69882&edit=1

« previous php.bugs (#193744) next »