xref: /PHP-5.6/ext/openssl/tests/bug55259.phpt (revision 84948e63)
1--TEST--
2Bug #55259 (openssl extension does not get the DH parameters from DH key resource)
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) die("skip"); ?>
5--FILE--
6<?php
7
8$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
9		'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
10		'7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
11		'6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
12$dh_details = array( 'p' => $phex, 'g' => '2' );
13$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, 'g' => '2' )));
14var_dump($dh);
15$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => hex2bin($phex), 'g' => '2' )));
16$details = openssl_pkey_get_details($dh);
17var_dump(bin2hex($details['dh']['p']));
18var_dump($details['dh']['g']);
19var_dump(strlen($details['dh']['pub_key']) > 0);
20var_dump(strlen($details['dh']['priv_key']) > 0);
21echo "Done";
22?>
23--EXPECT--
24bool(false)
25string(256) "dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61ef75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d2683705577d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e3826634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab"
26string(1) "2"
27bool(true)
28bool(true)
29Done
30