PHP  
 PHP_7_1
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/openssl/tests/openssl_peer_fingerprint_basic.phpt ('Testing peer fingerprint on connection')

Script

1: <?php
2: $serverCode 
= <<<'CODE'
3:
    $serverUri = "ssl://127.0.0.1:64321";
4:     $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
5:     $serverCtx = stream_context_create(['ssl' => [
6:         'local_cert' => __DIR__ . '/bug54992.pem'
7:     ]]);
8:
9:     $server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
10:     phpt_notify();
11:
12:     @stream_socket_accept($server, 1);
13:     @stream_socket_accept($server, 1);
14:
CODE;
15:
16:
$clientCode = <<<'CODE'
17:
    $serverUri = "ssl://127.0.0.1:64321";
18:     $clientFlags = STREAM_CLIENT_CONNECT;
19:     $clientCtx = stream_context_create(['ssl' => [
20:         'verify_peer'       => true,
21:         'cafile'            => __DIR__ . '/bug54992-ca.pem',
22:         'capture_peer_cert'    => true,
23:         'peer_name'          => 'bug54992.local',
24:     ]]);
25:
26:     phpt_wait();
27:
28:     // Run the following to get actual md5 (from sources root):
29:     // openssl x509 -noout -fingerprint -md5 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f'
30:     // Currently it's 4edbbaf40a6a4b6af22b6d6d9818378f
31:     // One below is intentionally broken (compare the last character):
32:     stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', '4edbbaf40a6a4b6af22b6d6d98183780');
33:     var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx));
34:
35:     // Run the following to get actual sha256 (from sources root):
36:     // openssl x509 -noout -fingerprint -sha256 -inform pem -in ext/openssl/tests/bug54992.pem | cut -d '=' -f 2 | tr -d ':' | tr 'A-F' 'a-f'
37:     stream_context_set_option($clientCtx, 'ssl', 'peer_fingerprint', [
38:         'sha256' => 'b1d480a2f83594fa243d26378cf611f334d369e59558d87e3de1abe8f36cb997',
39:     ]);
40:     var_dump(stream_socket_client($serverUri, $errno, $errstr, 2, $clientFlags, $clientCtx));
41:
CODE;
42:
43: include 
'ServerClientTestCase.inc';
44:
ServerClientTestCase::getInstance()->run($clientCode$serverCode);
45:
?>
46:

Expected

Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d

Warning: stream_socket_client(): Failed to enable crypto in %s on line %d

Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in %s on line %d
bool(false)
resource(%d) of type (stream)

Output

Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 17

Warning: stream_socket_client(): Failed to enable crypto in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 17

Warning: stream_socket_client(): unable to connect to ssl://127.0.0.1:64321 (Unknown error) in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 17
bool(false)
resource(10) of type (stream)

Diff

001+ Warning: stream_socket_client(): SSL: Handshake timed out in /var/php_gcov/PHP_7_1/ext/openssl/tests/ServerClientTestCase.inc(96) : eval()'d code on line 17
001- Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d

 

Generated at Fri, 15 Mar 2019 21:51:14 +0000 (7 days ago)

Copyright © 2005-2019 The PHP Group
All rights reserved.