xref: /PHP-8.1/ext/openssl/tests/bug28382.phpt (revision 0a530d76)
1--TEST--
2Bug #28382 (openssl_x509_parse extensions support)
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$cert = file_get_contents(__DIR__ . "/bug28382cert.txt");
8$ext = openssl_x509_parse($cert);
9var_dump($ext['extensions']);
10/*
11 * The reason for %A at the end of crlDistributionPoints and authorityKeyIdentifier is that
12 * OpenSSL 3.0 removes new lines which were present in previous versions.
13 */
14?>
15--EXPECTF--
16array(11) {
17  ["basicConstraints"]=>
18  string(8) "CA:FALSE"
19  ["nsComment"]=>
20  string(38) "For Grid use only; request tag userTag"
21  ["nsCertType"]=>
22  string(30) "SSL Client, SSL Server, S/MIME"
23  ["crlDistributionPoints"]=>
24  string(%d) "%AURI:http://mobile.blue-software.ro:90/ca/crl.shtml%A"
25  ["nsCaPolicyUrl"]=>
26  string(38) "http://mobile.blue-software.ro:90/pub/"
27  ["subjectAltName"]=>
28  string(28) "email:sergiu@bluesoftware.ro"
29  ["subjectKeyIdentifier"]=>
30  string(59) "B0:A7:FF:F9:41:15:DE:23:39:BD:DD:31:0F:97:A0:B2:A2:74:E0:FC"
31  ["authorityKeyIdentifier"]=>
32  string(%d) "DirName:/C=RO/ST=Romania/L=Craiova/O=Sergiu/OU=Sergiu SRL/CN=Sergiu CA/emailAddress=n_sergiu@hotmail.com
33serial:00%A"
34  ["keyUsage"]=>
35  string(71) "Digital Signature, Non Repudiation, Key Encipherment, Data Encipherment"
36  ["nsBaseUrl"]=>
37  string(20) "http://62.231.98.52/"
38  ["1.2.3.4"]=>
39  string(4) "%s"
40}
41