Skip to content

Commit 1ffb1b9

Browse files
committed
rely on provided openssl.cnf to avoid possible failure with system defaults
1 parent fbf0e05 commit 1ffb1b9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ext/openssl/tests/001.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
1818
usleep($i);
1919
}
2020

21-
$privkey = openssl_pkey_new();
21+
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
22+
$privkey = openssl_pkey_new($conf);
2223

2324
if ($privkey === false)
2425
die("failed to create private key");
@@ -30,7 +31,7 @@ if ($key_file_name === false)
3031

3132
echo "Export key to file\n";
3233

33-
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
34+
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
3435

3536
echo "Load key from file - array syntax\n";
3637

ext/openssl/tests/openssl_free_key.phpt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ for ($z = "", $i = 0; $i < 1024; $i++) {
2222
usleep($i);
2323
}
2424

25-
$privkey = openssl_pkey_new();
25+
$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
26+
$privkey = openssl_pkey_new($conf);
2627

2728
if ($privkey === false)
2829
die("failed to create private key");
@@ -34,7 +35,7 @@ if ($key_file_name === false)
3435

3536
echo "Export key to file\n";
3637

37-
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase) or die("failed to export to file $key_file_name");
38+
openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
3839

3940
echo "Load key from file - array syntax\n";
4041

0 commit comments

Comments
 (0)