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

Test Failure Report for ext/openssl/tests/001.phpt ('OpenSSL private key functions')

Script

1: <?php
2:
echo "Creating private key\n";
3:
4:
/* stack up some entropy; performance is not critical,
5:  * and being slow will most likely even help the test.
6:  */
7:
for ($z ""$i 0$i 1024$i++) {
8:     
$z .= $i $i;
9:     if (
function_exists("usleep"))
10:         
usleep($i);
11: }
12:
13:
$privkey openssl_pkey_new();
14:
15: if (
$privkey === false)
16:     die(
"failed to create private key");
17:
18:
$passphrase "banana";
19:
$key_file_name tempnam("/tmp""ssl");
20: if (
$key_file_name === false)
21:     die(
"failed to get a temporary filename!");
22:
23: echo 
"Export key to file\n";
24:
25:
openssl_pkey_export_to_file($privkey$key_file_name$passphrase) or die("failed to export to file $key_file_name");
26:
27: echo 
"Load key from file - array syntax\n";
28:
29:
$loaded_key openssl_pkey_get_private(array("file://$key_file_name"$passphrase));
30:
31: if (
$loaded_key === false)
32:     die(
"failed to load key using array syntax");
33:
34:
openssl_pkey_free($loaded_key);
35:
36: echo 
"Load key using direct syntax\n";
37:
38:
$loaded_key openssl_pkey_get_private("file://$key_file_name"$passphrase);
39:
40: if (
$loaded_key === false)
41:     die(
"failed to load key using direct syntax");
42:
43:
openssl_pkey_free($loaded_key);
44:
45: echo 
"Load key manually and use string syntax\n";
46:
47:
$key_content file_get_contents($key_file_name);
48:
$loaded_key openssl_pkey_get_private($key_content$passphrase);
49:
50: if (
$loaded_key === false)
51:     die(
"failed to load key using string syntax");
52:
53:
openssl_pkey_free($loaded_key);
54:
55: echo 
"OK!\n";
56:
57: @
unlink($key_file_name);
58:
59:
?>
60:

Expected

Creating private key
Export key to file
Load key from file - array syntax
Load key using direct syntax
Load key manually and use string syntax
OK!

Output

Creating private key

 ** ERROR: process timed out **

Diff

002+ 
003+  ** ERROR: process timed out **
002- Export key to file
003- Load key from file - array syntax
004- Load key using direct syntax
005- Load key manually and use string syntax
006- OK!

 

Generated at Fri, 17 May 2013 23:23:52 +0000 (45 hours ago)

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