mirror of
https://github.com/php/php-src.git
synced 2024-09-29 22:06:09 +00:00
2ff3dafccf
Squashed commit of the following:
commit a64c1d9bc4
Author: Tomasz Sawicki <falundir@gmail.com>
Date: Wed Jun 24 08:49:37 2015 +0200
Fix #69882: OpenSSL error "key values mismatch" after openssl_pkcs12_read with extra certs
The "key values mismatch" error is triggered in openssl_pkcs12_read by
PKCS12_parse, because it uses X509_check_private_key to separate main
certificate (which corresponds to private key) from extra certificates.
Extra certificates usually comes first (p12 contents are reversed as
stack) and X509_check_private_key triggers X509_R_KEY_VALUES_MISMATCH
error.
The fix pops "key values mismatch" error from OpenSSL error stack for
each extra certificate if there are any.
18 lines
396 B
PHP
18 lines
396 B
PHP
--TEST--
|
|
Bug #69882: OpenSSL error "key values mismatch" after openssl_pkcs12_read with extra certs
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded("openssl")) die("skip");
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$p12 = file_get_contents(__DIR__.'/p12_with_extra_certs.p12');
|
|
|
|
$result = openssl_pkcs12_read($p12, $cert_data, 'qwerty');
|
|
var_dump($result);
|
|
var_dump(openssl_error_string());
|
|
?>
|
|
--EXPECTF--
|
|
bool(true)
|
|
bool(false)
|