mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Merge branch 'PHP-8.1'
This commit is contained in:
commit
560a6166a1
@ -15,10 +15,10 @@ $dn = array(
|
||||
"commonName" => "Henrique do N. Angelo",
|
||||
"emailAddress" => "hnangelo@php.net"
|
||||
);
|
||||
|
||||
$options = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
|
||||
$privkey = openssl_pkey_new();
|
||||
$csr = openssl_csr_new($dn, $privkey);
|
||||
$cert = openssl_csr_sign($csr, null, $privkey, 365, [], PHP_INT_MAX);
|
||||
$csr = openssl_csr_new($dn, $privkey, $options);
|
||||
$cert = openssl_csr_sign($csr, null, $privkey, 365, $options, PHP_INT_MAX);
|
||||
var_dump(openssl_x509_parse($cert)['serialNumber']);
|
||||
?>
|
||||
--EXPECT--
|
||||
|
@ -4,8 +4,9 @@ Bug #72165 Null pointer dereference - openssl_csr_new
|
||||
openssl
|
||||
--FILE--
|
||||
<?php
|
||||
$var0 = array(0 => "hello", 1 => "world");
|
||||
$var2 = openssl_csr_new(array(0),$var0,null,array(0));
|
||||
$var0 = [0 => "hello", 1 => "world"];
|
||||
$options = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
|
||||
$var2 = openssl_csr_new([0], $var0, $options, [0]);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: openssl_csr_new(): dn: numeric fild names are not supported in %sbug72165.php on line %d
|
||||
|
@ -4,13 +4,16 @@ Bug #73711: Segfault in openssl_pkey_new when generating DSA or DH key
|
||||
openssl
|
||||
--FILE--
|
||||
<?php
|
||||
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
|
||||
var_dump(openssl_pkey_new([
|
||||
"private_key_type" => OPENSSL_KEYTYPE_DSA,
|
||||
"private_key_bits" => 1024,
|
||||
'config' => $config,
|
||||
]));
|
||||
var_dump(openssl_pkey_new([
|
||||
"private_key_type" => OPENSSL_KEYTYPE_DH,
|
||||
"private_key_bits" => 512,
|
||||
'config' => $config,
|
||||
]));
|
||||
echo "DONE";
|
||||
?>
|
||||
|
@ -6,9 +6,11 @@ openssl
|
||||
<?php if (!defined("OPENSSL_KEYTYPE_EC")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
|
||||
$args = array(
|
||||
"curve_name" => "secp384r1",
|
||||
"private_key_type" => OPENSSL_KEYTYPE_EC,
|
||||
"config" => $config,
|
||||
);
|
||||
echo "Testing openssl_pkey_new\n";
|
||||
$key1 = openssl_pkey_new($args);
|
||||
@ -17,6 +19,7 @@ var_dump($key1);
|
||||
$argsFailed = array(
|
||||
"curve_name" => "invalid_cuve_name",
|
||||
"private_key_type" => OPENSSL_KEYTYPE_EC,
|
||||
"config" => $config,
|
||||
);
|
||||
|
||||
$keyFailed = openssl_pkey_new($argsFailed);
|
||||
|
@ -100,18 +100,19 @@ echo "\n";
|
||||
$err_pem_no_start_line = '0480006C';
|
||||
|
||||
// PKEY
|
||||
$options = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
|
||||
echo "PKEY errors\n";
|
||||
// file for pkey (file:///) fails when opennig (BIO_new_file)
|
||||
@openssl_pkey_export_to_file("file://" . $invalid_file_for_read, $output_file);
|
||||
@openssl_pkey_export_to_file("file://" . $invalid_file_for_read, $output_file, null, $options);
|
||||
expect_openssl_errors('openssl_pkey_export_to_file opening', ['10000080']);
|
||||
// file or private pkey is not correct PEM - failing PEM_read_bio_PrivateKey
|
||||
@openssl_pkey_export_to_file($csr_file, $output_file);
|
||||
@openssl_pkey_export_to_file($csr_file, $output_file, null, $options);
|
||||
expect_openssl_errors('openssl_pkey_export_to_file pem', ['1E08010C']);
|
||||
// file to export cannot be written
|
||||
@openssl_pkey_export_to_file($private_key_file, $invalid_file_for_write);
|
||||
@openssl_pkey_export_to_file($private_key_file, $invalid_file_for_write, null, $options);
|
||||
expect_openssl_errors('openssl_pkey_export_to_file write', ['10080002']);
|
||||
// successful export
|
||||
@openssl_pkey_export($private_key_file_with_pass, $out, 'wrong pwd');
|
||||
@openssl_pkey_export($private_key_file_with_pass, $out, 'wrong pwd', $options);
|
||||
expect_openssl_errors('openssl_pkey_export', ['1C800064', '04800065']);
|
||||
// invalid x509 for getting public key
|
||||
@openssl_pkey_get_public($private_key_file);
|
||||
|
Loading…
Reference in New Issue
Block a user