xref: /PHP-7.4/ext/openssl/tests/bug28382.phpt (revision 26dfce7f)
1--TEST--
2Bug #28382 (openssl_x509_parse extensions support)
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip");
6?>
7--FILE--
8<?php
9$cert = file_get_contents(__DIR__ . "/bug28382cert.txt");
10$ext = openssl_x509_parse($cert);
11var_dump($ext['extensions']);
12/* openssl 1.0 prepends the string "Full Name:" to the crlDistributionPoints array key.
13	For now, as this is the one difference only between 0.9.x and 1.x, it's handled with
14	placeholders to not to duplicate the test. When more diffs come, a duplication would
15	be probably a better solution.
16*/
17?>
18--EXPECTF--
19array(11) {
20  ["basicConstraints"]=>
21  string(8) "CA:FALSE"
22  ["nsComment"]=>
23  string(38) "For Grid use only; request tag userTag"
24  ["nsCertType"]=>
25  string(30) "SSL Client, SSL Server, S/MIME"
26  ["crlDistributionPoints"]=>
27  string(%d) "%AURI:http://mobile.blue-software.ro:90/ca/crl.shtml
28"
29  ["nsCaPolicyUrl"]=>
30  string(38) "http://mobile.blue-software.ro:90/pub/"
31  ["subjectAltName"]=>
32  string(28) "email:sergiu@bluesoftware.ro"
33  ["subjectKeyIdentifier"]=>
34  string(59) "B0:A7:FF:F9:41:15:DE:23:39:BD:DD:31:0F:97:A0:B2:A2:74:E0:FC"
35  ["authorityKeyIdentifier"]=>
36  string(115) "DirName:/C=RO/ST=Romania/L=Craiova/O=Sergiu/OU=Sergiu SRL/CN=Sergiu CA/emailAddress=n_sergiu@hotmail.com
37serial:00
38"
39  ["keyUsage"]=>
40  string(71) "Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment"
41  ["nsBaseUrl"]=>
42  string(20) "http://62.231.98.52/"
43  ["1.2.3.4"]=>
44  string(4) "%s"
45}
46