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