xref: /PHP-8.1/ext/openssl/tests/bug74022_2.phpt (revision 5843ba51)
1--TEST--
2Bug #74022 PHP Fast CGI crashes when reading from a pfx file with valid password, multiple extra certs
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7function test($p12_contents, $password) {
8    openssl_pkcs12_read($p12_contents, $cert_data, $password);
9    openssl_error_string();
10    var_dump(count($cert_data['extracerts']));
11}
12
13$cert = file_get_contents(__DIR__ . "/public.crt");
14$priv = file_get_contents(__DIR__ . "/private.crt");
15$extracert = file_get_contents(__DIR__ . "/cert.crt");
16$pass = "qwerty";
17openssl_pkcs12_export($cert, $p12, $priv, $pass, array('extracerts' => [$extracert, $extracert]));
18
19test($p12, $pass);
20?>
21--EXPECT--
22int(2)
23