OpenSSL error “key values mismatch” after openssl_pkcs12_read with extra cer
| Bug #69882 | OpenSSL error “key values mismatch” after openssl_pkcs12_read with extra cer | ||||
|---|---|---|---|---|---|
| Submitted: | 2015-06-19 10:30 UTC | Modified: | 2016-06-19 16:35 UTC | ||
| From: | falundir at gmail dot com | Assigned: | bukka (profile) | ||
| Status: | Closed | Package: | OpenSSL related | ||
| PHP Version: | 5.6.7 | OS: | Debian 8.0 | ||
| Private report: | No | CVE-ID: | None | ||
[2015-06-19 10:30 UTC] 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
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2015-06-19 10:31 UTC] falundir at gmail dot com
-Summary: OpenSSL “key values mismatch” on SOAP HTTPS call mixed with openssl_pkcs12_r +Summary: OpenSSL “key values mismatch” on SOAP HTTPS mixed with openssl_pkcs12_read
[2015-06-19 10:31 UTC] falundir at gmail dot com
[2015-06-19 12:24 UTC] kalle@php.net
-PHP Version: 7.0.0alpha1 +PHP Version: 5.6.9
[2015-06-21 20:16 UTC] falundir at gmail dot com
-PHP Version: 5.6.9 +PHP Version: 5.6.7
[2015-06-21 20:16 UTC] falundir at gmail dot com
[2015-06-22 08:49 UTC] falundir at gmail dot com
-Package: SOAP related +Package: OpenSSL related
[2015-06-22 08:49 UTC] falundir at gmail dot com
[2015-06-22 19:48 UTC] falundir at gmail dot com
[2015-06-23 07:09 UTC] falundir at gmail dot com
[2015-06-23 08:28 UTC] falundir at gmail dot com
-Summary: OpenSSL “key values mismatch” on SOAP HTTPS mixed with openssl_pkcs12_read +Summary: OpenSSL error “key values mismatch” after openssl_pkcs12_read with extra certs
[2015-06-23 08:28 UTC] falundir at gmail dot com
[2015-06-24 10:00 UTC] falundir at gmail dot com
[2016-06-19 16:35 UTC] bukka@php.net
-Assigned To: +Assigned To: bukka
[2016-06-19 16:35 UTC] bukka@php.net