Skip to content

Commit 3f82da0

Browse files
committed
Add test for openssl_csr_new multi dn entry
1 parent 012ec21 commit 3f82da0

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
--TEST--
2+
openssl_csr_new() with array DN entry
3+
--EXTENSIONS--
4+
openssl
5+
--FILE--
6+
<?php
7+
8+
$a = array();
9+
10+
$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
11+
12+
// options type check
13+
$x = openssl_pkey_new($conf);
14+
$csr = openssl_csr_new(
15+
[
16+
"countryName" => "GB",
17+
"stateOrProvinceName" => "Somerset",
18+
"localityName" => "Glastonbury",
19+
"organizationName" => ["o1" => "PHP", "o2" => "PHP Foundation"],
20+
"organizationalUnitName" => ["PHP Doc team", "PHP Admin team", "PHP Core team"],
21+
"commonName" => "test.php.net",
22+
"emailAddress" => "php.test@example.com"
23+
],
24+
$x,
25+
$conf + ["x509_extensions" => 0xDEADBEEF]
26+
);
27+
28+
var_dump(openssl_csr_get_subject($csr));
29+
30+
?>
31+
--EXPECT--
32+
array(7) {
33+
["C"]=>
34+
string(2) "GB"
35+
["ST"]=>
36+
string(8) "Somerset"
37+
["L"]=>
38+
string(11) "Glastonbury"
39+
["O"]=>
40+
array(2) {
41+
[0]=>
42+
string(3) "PHP"
43+
[1]=>
44+
string(14) "PHP Foundation"
45+
}
46+
["OU"]=>
47+
array(3) {
48+
[0]=>
49+
string(12) "PHP Doc team"
50+
[1]=>
51+
string(14) "PHP Admin team"
52+
[2]=>
53+
string(13) "PHP Core team"
54+
}
55+
["CN"]=>
56+
string(12) "test.php.net"
57+
["emailAddress"]=>
58+
string(20) "php.test@example.com"
59+
}

0 commit comments

Comments
 (0)