summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2018-06-21 16:50:45 +0100
committerJakub Zelenka <bukka@php.net>2018-06-21 16:50:45 +0100
commit5f349b728e2a8864f6bc49f97014c2fc97619827 (patch)
treee3156d10edef9d6aea040af96bbda71ad3ebc154 /ext/openssl
parent55277a668409b9d62ac42695934aca64e354869f (diff)
parent77bd405959558c689b7f612fab8e537f36f6beac (diff)
downloadphp-git-5f349b728e2a8864f6bc49f97014c2fc97619827.tar.gz
Merge branch 'PHP-7.2'
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/tests/001.phpt41
-rw-r--r--ext/openssl/tests/bug28382.phpt3
-rw-r--r--ext/openssl/tests/bug36732.phpt21
-rw-r--r--ext/openssl/tests/bug37820.phpt8
-rw-r--r--ext/openssl/tests/bug38255.phpt6
-rw-r--r--ext/openssl/tests/bug38261.phpt6
-rw-r--r--ext/openssl/tests/bug39217.phpt6
-rw-r--r--ext/openssl/tests/bug41033.phpt1
-rw-r--r--ext/openssl/tests/bug46127.phpt3
-rw-r--r--ext/openssl/tests/bug48182.phpt3
-rw-r--r--ext/openssl/tests/bug54992.phpt2
-rw-r--r--ext/openssl/tests/bug55259.phpt12
-rw-r--r--ext/openssl/tests/bug55646.phpt46
-rw-r--r--ext/openssl/tests/bug61930.phpt4
-rw-r--r--ext/openssl/tests/bug65538_001.phpt2
-rw-r--r--ext/openssl/tests/bug65538_002.phpt12
-rw-r--r--ext/openssl/tests/bug65538_003.phpt2
-rw-r--r--ext/openssl/tests/bug65698.phpt4
-rw-r--r--ext/openssl/tests/bug65729.phpt2
-rw-r--r--ext/openssl/tests/bug66501.phpt2
-rw-r--r--ext/openssl/tests/bug67403.phpt4
-rw-r--r--ext/openssl/tests/bug68265.phpt2
-rw-r--r--ext/openssl/tests/bug68879.phpt2
-rw-r--r--ext/openssl/tests/bug68920.phpt2
-rw-r--r--ext/openssl/tests/bug69215.phpt2
-rw-r--r--ext/openssl/tests/bug70438.phpt6
-rw-r--r--ext/openssl/tests/bug71917.phpt16
-rw-r--r--ext/openssl/tests/bug72333.phpt92
-rw-r--r--ext/openssl/tests/bug72336.phpt16
-rw-r--r--ext/openssl/tests/bug72362.phpt22
-rw-r--r--ext/openssl/tests/bug73072.phpt37
-rw-r--r--ext/openssl/tests/bug73478.phpt10
-rw-r--r--ext/openssl/tests/bug73833.phpt22
-rw-r--r--ext/openssl/tests/bug74022_2.phpt6
-rw-r--r--ext/openssl/tests/bug74159.phpt107
-rw-r--r--ext/openssl/tests/bug74402.phpt8
-rw-r--r--ext/openssl/tests/bug74720_1.phpt4
-rw-r--r--ext/openssl/tests/bug74798.phpt4
-rw-r--r--ext/openssl/tests/bug74903.phpt166
-rw-r--r--ext/openssl/tests/bug76296.phpt2
-rw-r--r--ext/openssl/tests/capture_peer_cert_001.phpt2
-rw-r--r--ext/openssl/tests/check_default_conf_path.phpt2
-rw-r--r--ext/openssl/tests/cipher_tests.inc202
-rw-r--r--ext/openssl/tests/cve-2013-6420.phpt4
-rw-r--r--ext/openssl/tests/cve2013_4073.phpt4
-rw-r--r--ext/openssl/tests/ecc.phpt24
-rw-r--r--ext/openssl/tests/openssl_csr_export_bacis.phpt20
-rw-r--r--ext/openssl/tests/openssl_csr_export_to_file_basic.phpt30
-rw-r--r--ext/openssl/tests/openssl_csr_get_public_key_basic.phpt26
-rw-r--r--ext/openssl/tests/openssl_csr_get_subject_basic.phpt26
-rw-r--r--ext/openssl/tests/openssl_csr_sign_basic.phpt24
-rw-r--r--ext/openssl/tests/openssl_decrypt_ccm.phpt8
-rw-r--r--ext/openssl/tests/openssl_decrypt_gcm.phpt8
-rw-r--r--ext/openssl/tests/openssl_encrypt_ccm.phpt14
-rw-r--r--ext/openssl/tests/openssl_encrypt_gcm.phpt10
-rw-r--r--ext/openssl/tests/openssl_error_string_basic.phpt54
-rw-r--r--ext/openssl/tests/openssl_peer_fingerprint_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt14
-rw-r--r--ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt2
-rw-r--r--ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt12
-rw-r--r--ext/openssl/tests/openssl_pkcs7_sign_basic.phpt6
-rw-r--r--ext/openssl/tests/openssl_pkey_new_basic.phpt64
-rw-r--r--ext/openssl/tests/openssl_private_encrypt_basic.phpt6
-rw-r--r--ext/openssl/tests/openssl_public_encrypt_basic.phpt6
-rw-r--r--ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_spki_export_basic.phpt38
-rw-r--r--ext/openssl/tests/openssl_spki_export_challenge_basic.phpt40
-rw-r--r--ext/openssl/tests/openssl_spki_new_basic.phpt36
-rw-r--r--ext/openssl/tests/openssl_spki_verify_basic.phpt36
-rw-r--r--ext/openssl/tests/openssl_x509_export_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_x509_export_to_file_basic.phpt2
-rw-r--r--ext/openssl/tests/openssl_x509_fingerprint_basic.phpt4
-rw-r--r--ext/openssl/tests/openssl_x509_parse_basic.phpt4
-rw-r--r--ext/openssl/tests/peer_verification.phpt2
-rw-r--r--ext/openssl/tests/san_peer_matching.phpt2
-rw-r--r--ext/openssl/tests/session_meta_capture.phpt3
-rw-r--r--ext/openssl/tests/sni_server.phpt3
-rw-r--r--ext/openssl/tests/stream_crypto_flags_001.phpt2
-rw-r--r--ext/openssl/tests/stream_crypto_flags_002.phpt3
-rw-r--r--ext/openssl/tests/stream_crypto_flags_004.phpt2
-rw-r--r--ext/openssl/tests/stream_server_reneg_limit.phpt3
-rw-r--r--ext/openssl/tests/stream_verify_peer_name_001.phpt2
-rw-r--r--ext/openssl/tests/stream_verify_peer_name_002.phpt2
-rw-r--r--ext/openssl/tests/stream_verify_peer_name_003.phpt2
-rw-r--r--ext/openssl/tests/streams_crypto_method.phpt3
-rw-r--r--ext/openssl/tests/tlsv1.0_wrapper.phpt2
-rw-r--r--ext/openssl/tests/tlsv1.1_wrapper.phpt3
-rw-r--r--ext/openssl/tests/tlsv1.2_wrapper.phpt3
88 files changed, 780 insertions, 707 deletions
diff --git a/ext/openssl/tests/001.phpt b/ext/openssl/tests/001.phpt
index 9bcb3d890e..7f5af24ae6 100644
--- a/ext/openssl/tests/001.phpt
+++ b/ext/openssl/tests/001.phpt
@@ -9,28 +9,33 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
<?php
echo "Creating private key\n";
-$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
+$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
$privkey = openssl_pkey_new($conf);
-if ($privkey === false)
- die("failed to create private key");
+if ($privkey === false) {
+ die("failed to create private key");
+}
$passphrase = "banana";
-$key_file_name = tempnam(sys_get_temp_dir(), "ssl");
-if ($key_file_name === false)
- die("failed to get a temporary filename!");
+$key_file_name = __DIR__ . '/001-tmp.key';
+if ($key_file_name === false) {
+ die("failed to get a temporary filename!");
+}
echo "Export key to file\n";
-openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf) or die("failed to export to file $key_file_name");
+if (!openssl_pkey_export_to_file($privkey, $key_file_name, $passphrase, $conf)) {
+ die("failed to export to file $key_file_name");
+}
var_dump(is_resource($privkey));
echo "Load key from file - array syntax\n";
$loaded_key = openssl_pkey_get_private(array("file://$key_file_name", $passphrase));
-if ($loaded_key === false)
- die("failed to load key using array syntax");
+if ($loaded_key === false) {
+ die("failed to load key using array syntax");
+}
openssl_pkey_free($loaded_key);
@@ -38,8 +43,9 @@ echo "Load key using direct syntax\n";
$loaded_key = openssl_pkey_get_private("file://$key_file_name", $passphrase);
-if ($loaded_key === false)
- die("failed to load key using direct syntax");
+if ($loaded_key === false) {
+ die("failed to load key using direct syntax");
+}
openssl_pkey_free($loaded_key);
@@ -48,15 +54,13 @@ echo "Load key manually and use string syntax\n";
$key_content = file_get_contents($key_file_name);
$loaded_key = openssl_pkey_get_private($key_content, $passphrase);
-if ($loaded_key === false)
- die("failed to load key using string syntax");
-
+if ($loaded_key === false) {
+ die("failed to load key using string syntax");
+}
openssl_pkey_free($loaded_key);
echo "OK!\n";
-@unlink($key_file_name);
-
?>
--EXPECT--
Creating private key
@@ -66,3 +70,8 @@ Load key from file - array syntax
Load key using direct syntax
Load key manually and use string syntax
OK!
+--CLEAN--
+<?php
+$key_file_name = __DIR__ . DIRECTORY_SEPARATOR . '001-tmp.key';
+@unlink($key_file_name);
+?> \ No newline at end of file
diff --git a/ext/openssl/tests/bug28382.phpt b/ext/openssl/tests/bug28382.phpt
index 2bedeb2d67..c3888e962b 100644
--- a/ext/openssl/tests/bug28382.phpt
+++ b/ext/openssl/tests/bug28382.phpt
@@ -2,8 +2,7 @@
Bug #28382 (openssl_x509_parse extensions support)
--SKIPIF--
<?php
-if (!extension_loaded("openssl")) die("skip");
-if (OPENSSL_VERSION_NUMBER<0x009070af) die("skip");
+if (!extension_loaded("openssl")) die("skip");
?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug36732.phpt b/ext/openssl/tests/bug36732.phpt
index 83aa302100..72ca6904a9 100644
--- a/ext/openssl/tests/bug36732.phpt
+++ b/ext/openssl/tests/bug36732.phpt
@@ -3,22 +3,21 @@ Bug #36732 (add support for req_extensions in openss_csr_new and sign)
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
-if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
$configargs = array(
- "req_extensions" => "v3_req",
- "x509_extensions" => "usr_cert",
- "config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
+ "req_extensions" => "v3_req",
+ "x509_extensions" => "usr_cert",
+ "config" => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf",
);
$dn = array(
- "countryName" => "GB",
- "stateOrProvinceName" => "Berkshire",
- "localityName" => "Newbury",
- "organizationName" => "My Company Ltd",
- "commonName" => "Demo Cert"
+ "countryName" => "GB",
+ "stateOrProvinceName" => "Berkshire",
+ "localityName" => "Newbury",
+ "organizationName" => "My Company Ltd",
+ "commonName" => "Demo Cert"
);
$key = openssl_pkey_new();
@@ -29,11 +28,11 @@ $str = '';
openssl_csr_export($csr, $str, false);
if (strpos($str, 'Requested Extensions:')) {
- echo "Ok\n";
+ echo "Ok\n";
}
openssl_x509_export($crt, $str, false);
if (strpos($str, 'X509v3 extensions:')) {
- echo "Ok\n";
+ echo "Ok\n";
}
?>
--EXPECT--
diff --git a/ext/openssl/tests/bug37820.phpt b/ext/openssl/tests/bug37820.phpt
index b7df0dcd8f..d85a935ff3 100644
--- a/ext/openssl/tests/bug37820.phpt
+++ b/ext/openssl/tests/bug37820.phpt
@@ -3,7 +3,6 @@ openssl_sign/verify: accept different algos
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip");
-if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
@@ -15,19 +14,18 @@ $priv_key = file_get_contents($file_key);
$priv_key_id = openssl_get_privatekey($priv_key);
-
$pub_key = file_get_contents($file_pub);
$pub_key_id = openssl_get_publickey($pub_key);
$data = "some custom data";
if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
- echo "openssl_sign failed.";
+ echo "openssl_sign failed.";
}
$ok = openssl_verify($data, $signature, $pub_key_id, OPENSSL_ALGO_MD5);
if ($ok == 1) {
- echo "Ok";
+ echo "Ok";
} elseif ($ok == 0) {
- echo "openssl_verify failed.";
+ echo "openssl_verify failed.";
}
diff --git a/ext/openssl/tests/bug38255.phpt b/ext/openssl/tests/bug38255.phpt
index 4872605539..9eca6594a9 100644
--- a/ext/openssl/tests/bug38255.phpt
+++ b/ext/openssl/tests/bug38255.phpt
@@ -11,9 +11,9 @@ $signature = '';
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
class test {
- function __toString() {
- return "test object";
- }
+ function __toString() {
+ return "test object";
+ }
}
$t = new test;
diff --git a/ext/openssl/tests/bug38261.phpt b/ext/openssl/tests/bug38261.phpt
index 66de8b876c..6691947320 100644
--- a/ext/openssl/tests/bug38261.phpt
+++ b/ext/openssl/tests/bug38261.phpt
@@ -8,9 +8,9 @@ if (!extension_loaded("openssl")) die("skip");
<?php
$cert = false;
class test {
- function __toString() {
- return "test object";
- }
+ function __toString() {
+ return "test object";
+ }
}
$t = new test;
diff --git a/ext/openssl/tests/bug39217.phpt b/ext/openssl/tests/bug39217.phpt
index 8bafedbab4..47f234d769 100644
--- a/ext/openssl/tests/bug39217.phpt
+++ b/ext/openssl/tests/bug39217.phpt
@@ -9,9 +9,9 @@ if (!extension_loaded("openssl")) die("skip");
$dir = dirname(__FILE__);
$certs = array('bug39217cert2.txt', 'bug39217cert1.txt');
foreach($certs as $cert) {
- $res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
- print_r($res['serialNumber']);
- echo "\n";
+ $res = openssl_x509_parse(file_get_contents($dir . '/' . $cert));
+ print_r($res['serialNumber']);
+ echo "\n";
}
?>
--EXPECT--
diff --git a/ext/openssl/tests/bug41033.phpt b/ext/openssl/tests/bug41033.phpt
index 4e9bea3e3e..f52a4c7d27 100644
--- a/ext/openssl/tests/bug41033.phpt
+++ b/ext/openssl/tests/bug41033.phpt
@@ -3,7 +3,6 @@
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip, openssl required");
-if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip");
?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug46127.phpt b/ext/openssl/tests/bug46127.phpt
index 5410d2f87e..f11d8baf0b 100644
--- a/ext/openssl/tests/bug46127.phpt
+++ b/ext/openssl/tests/bug46127.phpt
@@ -4,7 +4,7 @@
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -38,5 +38,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
Sending bug 46127
diff --git a/ext/openssl/tests/bug48182.phpt b/ext/openssl/tests/bug48182.phpt
index e528b43cad..dcadaaa6b9 100644
--- a/ext/openssl/tests/bug48182.phpt
+++ b/ext/openssl/tests/bug48182.phpt
@@ -4,7 +4,7 @@ Bug #48182: ssl handshake fails during asynchronous socket connection
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x009070af) die("skip openssl version too low");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -44,6 +44,7 @@ echo "Running bug48182\n";
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
Running bug48182
Sending bug48182
diff --git a/ext/openssl/tests/bug54992.phpt b/ext/openssl/tests/bug54992.phpt
index 878cb4a872..01369dca00 100644
--- a/ext/openssl/tests/bug54992.phpt
+++ b/ext/openssl/tests/bug54992.phpt
@@ -4,6 +4,7 @@ Bug #54992: Stream not closed and error not returned when SSL CN_match fails
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`bug54992.local' did not match expected CN=`buga_buga' in %s on line %d
diff --git a/ext/openssl/tests/bug55259.phpt b/ext/openssl/tests/bug55259.phpt
index b58d28ad73..88e5a17ce4 100644
--- a/ext/openssl/tests/bug55259.phpt
+++ b/ext/openssl/tests/bug55259.phpt
@@ -6,13 +6,13 @@ Bug #55259 (openssl extension does not get the DH parameters from DH key resourc
<?php
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
- 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
- '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
- '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
-$dh_details = array( 'p' => $phex, 'g' => '2' );
-$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => $phex, 'g' => '2' )));
+ 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
+ '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
+ '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
+$dh_details = array('p' => $phex, 'g' => '2');
+$dh = openssl_pkey_new(array('dh'=> array('p' => $phex, 'g' => '2')));
var_dump($dh);
-$dh = openssl_pkey_new(array( 'dh'=> array( 'p' => hex2bin($phex), 'g' => '2' )));
+$dh = openssl_pkey_new(array('dh'=> array( 'p' => hex2bin($phex), 'g' => '2')));
$details = openssl_pkey_get_details($dh);
var_dump(bin2hex($details['dh']['p']));
var_dump($details['dh']['g']);
diff --git a/ext/openssl/tests/bug55646.phpt b/ext/openssl/tests/bug55646.phpt
index 6c504588c8..a7e4152779 100644
--- a/ext/openssl/tests/bug55646.phpt
+++ b/ext/openssl/tests/bug55646.phpt
@@ -1,28 +1,43 @@
--TEST--
Bug #55646: textual input in openssl_csr_new() is not expected in UTF-8
--SKIPIF--
-<?php
-if (!function_exists('openssl_csr_new'))
- die('skip no openssl extension');
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
-function stringAsHex($string){$unpacked = unpack("H*", $string);return implode(" ", str_split($unpacked[1],2));}
-$config = array("digest_alg" => "sha1","x509_extensions" => "v3_ca","req_extensions" => "v3_req","private_key_bits" => 2048,"private_key_type" => OPENSSL_KEYTYPE_RSA,"encrypt_key" => false,);
+function stringAsHex($string) {
+ $unpacked = unpack("H*", $string);
+ return implode(" ", str_split($unpacked[1],2));
+}
+
+$config = array(
+ "digest_alg" => "sha1",
+ "x509_extensions" => "v3_ca",
+ "req_extensions" => "v3_req",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_RSA,
+ "encrypt_key" => false,
+);
$csr_info = array(
- "countryName" => "US",
- "stateOrProvinceName" => "Utah",
- "localityName" => "Lindon",
- "organizationName" => "Chinese",
- "organizationalUnitName" => "IT \xe4\xba\x92",
- "commonName" => "www.example.com",);
+ "countryName" => "US",
+ "stateOrProvinceName" => "Utah",
+ "localityName" => "Lindon",
+ "organizationName" => "Chinese",
+ "organizationalUnitName" => "IT \xe4\xba\x92",
+ "commonName" => "www.example.com",
+);
$private = openssl_pkey_new($config);
while (openssl_error_string()) {}
-$csr_res = openssl_csr_new($csr_info, $private,
- ['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]);
+$csr_res = openssl_csr_new(
+ $csr_info,
+ $private,
+ ['config' => __DIR__. DIRECTORY_SEPARATOR . "openssl.cnf"]
+);
if (!$csr_res) {
- while ($e = openssl_error_string()) { $err = $e; }
- die("Failed; last error: $err");
+ while ($e = openssl_error_string()) {
+ $err = $e;
+ }
+ die("Failed; last error: $err");
}
openssl_csr_export($csr_res, $csr);
$output = openssl_csr_get_subject($csr);
@@ -31,6 +46,7 @@ echo "A: ".$csr_info["organizationalUnitName"]."\n";
echo "B: ".stringAsHex($csr_info["organizationalUnitName"])."\n";
echo "C: ".$output['OU']."\n";
echo "D: ".stringAsHex($output['OU'])."\n";
+?>
--EXPECT--
A: IT 互
B: 49 54 20 e4 ba 92
diff --git a/ext/openssl/tests/bug61930.phpt b/ext/openssl/tests/bug61930.phpt
index 55dc42fded..6d8742b80d 100644
--- a/ext/openssl/tests/bug61930.phpt
+++ b/ext/openssl/tests/bug61930.phpt
@@ -12,7 +12,9 @@ $data = <<<DATA
Please verify me
DATA;
-$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptlAODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
+$sig = 'f9Gyb6NV/ENn7GUa37ygTLcF93XHf5fbFTnoYF/O+fXbq3iChGUbET0RuhOsptl' .
+ 'AODi6JsDLnJO4ikcVZo0tC1fFTj3LyCuPy3ZdgJbbVxQ/rviROCmuMFTqUW/Xa2' .
+ 'LQYiapeCCgLQeWTLg7TM/BoHEkKbKLG/XT5jHvep1758A=';
$key = openssl_get_publickey($cert);
var_dump(openssl_get_publickey($key));
diff --git a/ext/openssl/tests/bug65538_001.phpt b/ext/openssl/tests/bug65538_001.phpt
index e666859d0d..290bbeff35 100644
--- a/ext/openssl/tests/bug65538_001.phpt
+++ b/ext/openssl/tests/bug65538_001.phpt
@@ -4,6 +4,7 @@ Bug #65538: SSL context "cafile" supports stream wrappers
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -48,5 +49,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
string(12) "Hello World!"
diff --git a/ext/openssl/tests/bug65538_002.phpt b/ext/openssl/tests/bug65538_002.phpt
index 21a23a2678..7dddb12564 100644
--- a/ext/openssl/tests/bug65538_002.phpt
+++ b/ext/openssl/tests/bug65538_002.phpt
@@ -8,12 +8,12 @@ if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
--FILE--
<?php
$clientCtx = stream_context_create(['ssl' => [
- // We don't get any ca list from php.net but it does not matter as we
- // care about the fact that the external stream is not allowed.
- // We can't use http://curl.haxx.se/ca/cacert.pem for this test
- // as it is redirected to https which means the test would depend
- // on system cafile when opening stream.
- 'cafile' => 'http://www.php.net',
+ // We don't get any ca list from php.net but it does not matter as we
+ // care about the fact that the external stream is not allowed.
+ // We can't use http://curl.haxx.se/ca/cacert.pem for this test
+ // as it is redirected to https which means the test would depend
+ // on system cafile when opening stream.
+ 'cafile' => 'http://www.php.net',
]]);
file_get_contents('https://github.com', false, $clientCtx);
?>
diff --git a/ext/openssl/tests/bug65538_003.phpt b/ext/openssl/tests/bug65538_003.phpt
index 80280d1e15..0597ceaef9 100644
--- a/ext/openssl/tests/bug65538_003.phpt
+++ b/ext/openssl/tests/bug65538_003.phpt
@@ -5,6 +5,7 @@ Bug #65538: SSL context "cafile" supports phar wrapper
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!extension_loaded("phar")) die("skip phar not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -49,5 +50,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
string(12) "Hello World!"
diff --git a/ext/openssl/tests/bug65698.phpt b/ext/openssl/tests/bug65698.phpt
index 5b693421fe..ba1efc739c 100644
--- a/ext/openssl/tests/bug65698.phpt
+++ b/ext/openssl/tests/bug65698.phpt
@@ -1,9 +1,7 @@
--TEST--
Bug #65689 (GeneralizedTime format parsing)
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$crt = substr(__FILE__, 0, -4).'.crt';
diff --git a/ext/openssl/tests/bug65729.phpt b/ext/openssl/tests/bug65729.phpt
index 347dc55e75..5e91197b70 100644
--- a/ext/openssl/tests/bug65729.phpt
+++ b/ext/openssl/tests/bug65729.phpt
@@ -4,6 +4,7 @@ Bug #65729: CN_match gives false positive when wildcard is used
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -42,6 +43,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`*.test.com' did not match expected CN=`foo.test.com.sg' in %s on line %d
diff --git a/ext/openssl/tests/bug66501.phpt b/ext/openssl/tests/bug66501.phpt
index daf7cb6aa0..34dac6d44a 100644
--- a/ext/openssl/tests/bug66501.phpt
+++ b/ext/openssl/tests/bug66501.phpt
@@ -4,6 +4,7 @@ Bug #66501: EC private key support in openssl_sign
<?php
if (!extension_loaded("openssl")) die("skip");
if (!defined('OPENSSL_KEYTYPE_EC')) die("skip no EC available");
+?>
--FILE--
<?php
$pkey = 'ASN1 OID: prime256v1
@@ -18,5 +19,6 @@ sqOTOnMoezkbSmVVMuwz9flvnqHGmQvmug==
$key = openssl_pkey_get_private($pkey);
$res = openssl_sign($data ='alpha', $sign, $key, 'SHA1');
var_dump($res);
+?>
--EXPECT--
bool(true)
diff --git a/ext/openssl/tests/bug67403.phpt b/ext/openssl/tests/bug67403.phpt
index 19701af381..add6c09d72 100644
--- a/ext/openssl/tests/bug67403.phpt
+++ b/ext/openssl/tests/bug67403.phpt
@@ -1,8 +1,7 @@
--TEST--
Bug #67403: Add signatureType to openssl_x509_parse
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$r = openssl_x509_parse(file_get_contents(__DIR__.'/bug64802.pem'));
@@ -14,6 +13,7 @@ $r = openssl_x509_parse(file_get_contents(__DIR__.'/bug37820cert.pem'));
var_dump($r['signatureTypeSN']);
var_dump($r['signatureTypeLN']);
var_dump($r['signatureTypeNID']);
+?>
--EXPECT--
string(8) "RSA-SHA1"
string(21) "sha1WithRSAEncryption"
diff --git a/ext/openssl/tests/bug68265.phpt b/ext/openssl/tests/bug68265.phpt
index aff9a9e511..f2c867670a 100644
--- a/ext/openssl/tests/bug68265.phpt
+++ b/ext/openssl/tests/bug68265.phpt
@@ -4,6 +4,7 @@ Bug #68265: SAN match fails with trailing DNS dot
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/bug68879.phpt b/ext/openssl/tests/bug68879.phpt
index 2982d00c36..8cf9044c93 100644
--- a/ext/openssl/tests/bug68879.phpt
+++ b/ext/openssl/tests/bug68879.phpt
@@ -4,6 +4,7 @@ Bug #68879: Match IP address fields in subjectAltName checks
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,6 +37,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/bug68920.phpt b/ext/openssl/tests/bug68920.phpt
index 52a103f641..4c6271819b 100644
--- a/ext/openssl/tests/bug68920.phpt
+++ b/ext/openssl/tests/bug68920.phpt
@@ -4,6 +4,7 @@ Bug #68920: peer_fingerprint input checks should be strict
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -47,6 +48,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
Warning: stream_socket_client(): Expected peer fingerprint must be a string or an array in %s on line %d
diff --git a/ext/openssl/tests/bug69215.phpt b/ext/openssl/tests/bug69215.phpt
index 2e2fe9222b..ab9eec6770 100644
--- a/ext/openssl/tests/bug69215.phpt
+++ b/ext/openssl/tests/bug69215.phpt
@@ -4,6 +4,7 @@ Bug #69215: Crypto servers should send client CA list
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -43,6 +44,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/bug70438.phpt b/ext/openssl/tests/bug70438.phpt
index 937e9f3bd9..e25c37168b 100644
--- a/ext/openssl/tests/bug70438.phpt
+++ b/ext/openssl/tests/bug70438.phpt
@@ -2,11 +2,9 @@
Request #70438: Add IV parameter for openssl_seal and openssl_open
--SKIPIF--
<?php
-if (!extension_loaded("openssl")) {
- print "skip";
-}
+if (!extension_loaded("openssl")) print "skip";
if (!in_array('AES-128-CBC', openssl_get_cipher_methods(true))) {
- print "skip";
+ print "skip";
}
?>
--FILE--
diff --git a/ext/openssl/tests/bug71917.phpt b/ext/openssl/tests/bug71917.phpt
index d4415b3e32..c7f91dbb55 100644
--- a/ext/openssl/tests/bug71917.phpt
+++ b/ext/openssl/tests/bug71917.phpt
@@ -7,12 +7,16 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
--FILE--
<?php
function test($envkey) {
- $publicKey = "file://" . dirname(__FILE__) . "/public.key";
- $privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
- openssl_public_encrypt($envkey, $envelope, $publicKey);
- $sealed = openssl_encrypt('plaintext', 'rc4', $envkey, OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY);
- openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
- var_dump($output === 'plaintext');
+ $publicKey = "file://" . dirname(__FILE__) . "/public.key";
+ $privateKey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
+ openssl_public_encrypt($envkey, $envelope, $publicKey);
+ $sealed = openssl_encrypt(
+ 'plaintext',
+ 'rc4', $envkey,
+ OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
+ );
+ openssl_open($sealed, $output, $envelope, $privateKey, 'rc4');
+ var_dump($output === 'plaintext');
}
// works - key of 16 bytes
diff --git a/ext/openssl/tests/bug72333.phpt b/ext/openssl/tests/bug72333.phpt
index a7b1c93b15..1350df8501 100644
--- a/ext/openssl/tests/bug72333.phpt
+++ b/ext/openssl/tests/bug72333.phpt
@@ -8,56 +8,56 @@ if (!function_exists("proc_open")) die("skip no proc_open");
--FILE--
<?php
$serverCode = <<<'CODE'
- $context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
+ $context = stream_context_create(['ssl' => ['local_cert' => __DIR__ . '/bug54992.pem']]);
- $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
- $fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
- phpt_notify();
- $conn = stream_socket_accept($fp);
- $total = 100000;
- $result = fread($conn, $total);
- stream_set_blocking($conn, false);
- usleep(50000);
- $read = [$conn];
- while (stream_select($read, $write, $except, 1)) {
- $result = fread($conn, 100000);
- if (!$result) {
- break;
- }
- $total += strlen($result);
- if ($total >= 4000000) {
- break;
- }
- }
- phpt_wait();
+ $flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
+ $fp = stream_socket_server("ssl://127.0.0.1:10011", $errornum, $errorstr, $flags, $context);
+ phpt_notify();
+ $conn = stream_socket_accept($fp);
+ $total = 100000;
+ $result = fread($conn, $total);
+ stream_set_blocking($conn, false);
+ usleep(50000);
+ $read = [$conn];
+ while (stream_select($read, $write, $except, 1)) {
+ $result = fread($conn, 100000);
+ if (!$result) {
+ break;
+ }
+ $total += strlen($result);
+ if ($total >= 4000000) {
+ break;
+ }
+ }
+ phpt_wait();
CODE;
$clientCode = <<<'CODE'
- $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
-
- phpt_wait();
- $fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
- stream_set_blocking($fp, false);
-
- function blocking_fwrite($fp, $buf) {
- $write = [$fp];
- $total = 0;
- while (stream_select($read, $write, $except, 1)) {
- $result = fwrite($fp, $buf);
- if (!$result) {
- break;
- }
- $total += $result;
- if ($total >= strlen($buf)) {
- return $total;
- }
- $buf = substr($buf, $total);
- }
- }
- $str1 = str_repeat("a", 4000000);
- blocking_fwrite($fp, $str1);
- phpt_notify();
- echo "done";
+ $context = stream_context_create(['ssl' => ['verify_peer' => false, 'peer_name' => 'bug54992.local']]);
+
+ phpt_wait();
+ $fp = stream_socket_client("ssl://127.0.0.1:10011", $errornum, $errorstr, 3000, STREAM_CLIENT_CONNECT, $context);
+ stream_set_blocking($fp, false);
+
+ function blocking_fwrite($fp, $buf) {
+ $write = [$fp];
+ $total = 0;
+ while (stream_select($read, $write, $except, 1)) {
+ $result = fwrite($fp, $buf);
+ if (!$result) {
+ break;
+ }
+ $total += $result;
+ if ($total >= strlen($buf)) {
+ return $total;
+ }
+ $buf = substr($buf, $total);
+ }
+ }
+ $str1 = str_repeat("a", 4000000);
+ blocking_fwrite($fp, $str1);
+ phpt_notify();
+ echo "done";
CODE;
include 'ServerClientTestCase.inc';
diff --git a/ext/openssl/tests/bug72336.phpt b/ext/openssl/tests/bug72336.phpt
index 893b51838d..1defd21dfc 100644
--- a/ext/openssl/tests/bug72336.phpt
+++ b/ext/openssl/tests/bug72336.phpt
@@ -5,18 +5,18 @@ Bug #72336 (openssl_pkey_new does not fail for invalid DSA params)
--FILE--
<?php
$p = '00f8000ae45b2dacb47dd977d58b719d097bdf07cb2c17660ad898518c08' .
- '1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
- '24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
- '1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
- '996def90090303b7ad';
+ '1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
+ '24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
+ '1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
+ '996def90090303b7ad';
$q = '009b3734fc9f7a4a9d6437ec314e0a78c2889af64b';
$g = '00b320300a0bc55b8f0ec6edc218e2185250f38fbb8291db8a89227f6e41' .
- '00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
- 'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
- '4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
- 'b81747c4c447a941f3';
+ '00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
+ 'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
+ '4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
+ 'b81747c4c447a941f3';
var_dump(openssl_pkey_new(array('dsa' => array('p' => $p, 'q' => $q, 'g' => $g))));
?>
diff --git a/ext/openssl/tests/bug72362.phpt b/ext/openssl/tests/bug72362.phpt
index 40acdbed0c..cd6ec1e838 100644
--- a/ext/openssl/tests/bug72362.phpt
+++ b/ext/openssl/tests/bug72362.phpt
@@ -6,8 +6,26 @@ if (!extension_loaded("openssl")) die("skip openssl not loaded");
?>
--FILE--
<?php
-var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","12345678", OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY)));
-var_dump(bin2hex(openssl_encrypt("this is a test string","bf-ecb","1234567812345678" , OPENSSL_RAW_DATA)));
+var_dump(
+ bin2hex(
+ openssl_encrypt(
+ "this is a test string",
+ "bf-ecb",
+ "12345678",
+ OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
+ )
+ )
+);
+var_dump(
+ bin2hex(
+ openssl_encrypt(
+ "this is a test string",
+ "bf-ecb",
+ "1234567812345678",
+ OPENSSL_RAW_DATA
+ )
+ )
+);
?>
--EXPECT--
string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
diff --git a/ext/openssl/tests/bug73072.phpt b/ext/openssl/tests/bug73072.phpt
index cc352233e1..8f001829f2 100644
--- a/ext/openssl/tests/bug73072.phpt
+++ b/ext/openssl/tests/bug73072.phpt
@@ -3,39 +3,40 @@ Bug #73072: Invalid path SNI_server_certs causes segfault
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
+if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$serverCode = <<<'CODE'
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
- $ctx = stream_context_create(['ssl' => [
- 'local_cert' => __DIR__ . '/domain1.pem',
- 'SNI_server_certs' => [
- "domain1.com" => __DIR__ . "/sni_server_domain1.pem",
- "domain2.com" => __DIR__ . "/not_existing.pem",
- ]
- ]]);
-
+ $ctx = stream_context_create(['ssl' => [
+ 'local_cert' => __DIR__ . '/domain1.pem',
+ 'SNI_server_certs' => [
+ "domain1.com" => __DIR__ . "/sni_server_domain1.pem",
+ "domain2.com" => __DIR__ . "/not_existing.pem",
+ ]
+ ]]);
+
$server = stream_socket_server('tls://127.0.0.1:64322', $errno, $errstr, $flags, $ctx);
-
+
phpt_notify();
- @stream_socket_accept($server, 3);
- // if there is a segfault, this won't be called
- fwrite(STDERR, "done\n");
+ @stream_socket_accept($server, 3);
+ // if there is a segfault, this won't be called
+ fwrite(STDERR, "done\n");
CODE;
$clientCode = <<<'CODE'
$flags = STREAM_CLIENT_CONNECT;
- $ctxArr = [
- 'cafile' => __DIR__ . '/sni_server_ca.pem',
- 'capture_peer_cert' => true
- ];
+ $ctxArr = [
+ 'cafile' => __DIR__ . '/sni_server_ca.pem',
+ 'capture_peer_cert' => true
+ ];
phpt_wait();
$ctxArr['peer_name'] = 'domain1.com';
- $ctx = stream_context_create(['ssl' => $ctxArr]);
- @stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
+ $ctx = stream_context_create(['ssl' => $ctxArr]);
+ @stream_socket_client("tls://127.0.0.1:64322", $errno, $errstr, 1, $flags, $ctx);
CODE;
include 'ServerClientTestCase.inc';
diff --git a/ext/openssl/tests/bug73478.phpt b/ext/openssl/tests/bug73478.phpt
index 1dfc584164..61f0faa057 100644
--- a/ext/openssl/tests/bug73478.phpt
+++ b/ext/openssl/tests/bug73478.phpt
@@ -1,15 +1,13 @@
--TEST--
Bug #73478: openssl_pkey_new() generates wrong pub/priv keys with Diffie Hellman
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip openssl not loaded");
-?>
+<?php if (!extension_loaded("openssl")) die("skip openssl not loaded"); ?>
--FILE--
<?php
$details = [
- 'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
- 'g' => base64_decode('Ag=='),
- 'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
+ 'p' => base64_decode('3Pk6C4g5cuwOGZiaxaLOMQ4dN3F+jZVxu3Yjcxhm5h73Wi4niYsFf5iRwuJ6Y5w/KbYIFFgc07LKOYbSaDcFV31FwuflLcgcehcYduXOp0sUSL/frxiCjv0lGfFOReOCZjSvGUnltTXMgppIO4p2Ij5dSQolfwW9/xby+yLFg6s='),
+ 'g' => base64_decode('Ag=='),
+ 'priv_key' => base64_decode('jUdcV++P/m7oUodWiqKqKXZVenHRuj92Ig6Fmzs7QlqVdUc5mNBxmEWjug+ObffanPpOeab/LyXwjNMzevtBz3tW4oROau++9EIMJVVQr8fW9zdYBJcYieC5l4t8nRj5/Uu/Z0G2rWVLBleSi28mqqNEvnUs7uxYxrar69lwQYs=')
];
$opensslKeyResource = openssl_pkey_new(['dh' => $details]);
diff --git a/ext/openssl/tests/bug73833.phpt b/ext/openssl/tests/bug73833.phpt
index 2ea5f9e411..ad4e0874a8 100644
--- a/ext/openssl/tests/bug73833.phpt
+++ b/ext/openssl/tests/bug73833.phpt
@@ -10,18 +10,18 @@ $passwords = ["abc\x00defghijkl", "abcdefghikjl"];
$conf = ['config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf'];
foreach($passwords as $password) {
- $key = openssl_pkey_new($conf);
+ $key = openssl_pkey_new($conf);
- if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
- echo "Failed to encrypt.\n";
- } else {
- echo "Encrypted!\n";
- }
- if (openssl_pkey_get_private($privatePEM, $password) === false) {
- echo "Failed to decrypt.\n";
- } else {
- echo "Decrypted!\n";
- }
+ if (openssl_pkey_export($key, $privatePEM, $password, $conf) === false) {
+ echo "Failed to encrypt.\n";
+ } else {
+ echo "Encrypted!\n";
+ }
+ if (openssl_pkey_get_private($privatePEM, $password) === false) {
+ echo "Failed to decrypt.\n";
+ } else {
+ echo "Decrypted!\n";
+ }
}
?>
--EXPECT--
diff --git a/ext/openssl/tests/bug74022_2.phpt b/ext/openssl/tests/bug74022_2.phpt
index 356e22549f..07cb683274 100644
--- a/ext/openssl/tests/bug74022_2.phpt
+++ b/ext/openssl/tests/bug74022_2.phpt
@@ -7,9 +7,9 @@ if (!extension_loaded("openssl")) die("skip");
--FILE--
<?php
function test($p12_contents, $password) {
- openssl_pkcs12_read($p12_contents, $cert_data, $password);
- openssl_error_string();
- var_dump(count($cert_data['extracerts']));
+ openssl_pkcs12_read($p12_contents, $cert_data, $password);
+ openssl_error_string();
+ var_dump(count($cert_data['extracerts']));
}
$p12_base64 = 'MIIW+QIBAzCCFr8GCSqGSIb3DQEHAaCCFrAEghasMIIWqDCCEV8GCSqGSIb3DQEHBqCCEVAwghFMAgEAMIIRRQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIQOfCxIAgGIICAggAgIIRGFTkvHpJjCtFjukXYVlhyOIqKiS8Zvg84dX244hhI0S51Uyn/tlXM2GD/3hDNVxcVKwP/fKN21lEkoXoK4h2/5BY3qCdZa3Ef3vk44b/+FGCUAqvsOo1ZjD2P/sBGhLu3aFnQ6ktUXlKV4cnqhlF62AqY4e5efQzmJXn+gI8cSNI5c+qQ0RQgGoRY4nJfvMSZG0/DAkirjGikU/2TZd8LwLkxVUBYbF5/T0fNtA3o99+4tF+8ZRv6ArYjplRdwcBbMbzGhn3ytCq6cmVid9iLjwHJFmvAPXKbmu0Lh5eRRznX9gBWlzGd08Q/ch0MW2ehZTu1A2VrNWl+FKWSk8l0MlSoTPJFutFiejRvMr6VzbQItyJ/mtrNa9b1Hicgoj9HaBB6arx4wKORlbSOxFNOWdTCUhFdqthK5o7b9i/owyVgyY0s7BFEZChc0zGpRq7BLrynY79b+pHKzpil9isuisp1++piHZx9Y/bpC7OP5FlYF9+3TJL0EpEFQD8FqEoqcMFRxIDWGpCQiLGcmL14OH1JKSgOJEAgogsIF/KQhvWeKcUSJlai+0sskl8mOrCt2EJwuRvzmemuzebYN3JMOiBXKONYR0yU8AeAyNTgSBimWhACtikUyfpgZXlIeXyFMvj9fmd0I/zqjaW4upqrCudCOj/CWx7+e+8udfJxI7agWwrZMf1BEkOhRFOHOIuV+IEbaoMP6vVrGlhK71oN+gnoes5ivohpFDJWSZ3+1fMh56vfNynuM2wLJO7FTROPla+4ug33V/2ubGpoIyXn2lTSbuXaYDfsXMa1inakOMW9Q+PHGdIjZrwQU/u9Q2H0IlwFd4uQojZo15SRf4xh5FOuUrrfGRAnp1mWHALTBqd2Vn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ounjbcDrFyYaFxYXEqyO9L6vFShO5z7/vD5h9uLPddE4vC6PKJxZoWopWncLcLljuYKG0k+y4MV9U0/cESYJWzBbcZZpULdesinhxMg1wNPu5FeeFCsZpdhN2FadIuu/Kcsk6xNeDDIwwYXb3hVY0ARRAo//LyLv3zDB0LWz1LH3qJQeZ53DbgZ4VXQ6uK0yTgSsH4Lwaj5oFBPp4NJ3hdGa7trpJbeUMIxJTAjBgkqhkiG9w0BCRUxFgQUh6FIxf4sbyJnvvC+6J1NHGaa9w0wMTAhMAkGBSsOAwIaBQAEFFkCkI701QHxh2zcZkzDy8bn7qKwBAjafnZaU5r0FgICCAA=';
diff --git a/ext/openssl/tests/bug74159.phpt b/ext/openssl/tests/bug74159.phpt
index 0ca8fb7db3..f6dd786eca 100644
--- a/ext/openssl/tests/bug74159.phpt
+++ b/ext/openssl/tests/bug74159.phpt
@@ -4,7 +4,6 @@ Bug #74159: Writing a large buffer to non-blocking encrypted streams fails
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
?>
--FILE--
<?php
@@ -13,93 +12,93 @@ if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
// scenarios which might be useful. More reliable test is bug72333.phpt
$serverCode = <<<'CODE'
$serverUri = "ssl://127.0.0.1:10012";
- $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
- $serverCtx = stream_context_create(['ssl' => [
- 'local_cert' => __DIR__ . '/bug54992.pem',
- 'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
- ]]);
+ $serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
+ $serverCtx = stream_context_create(['ssl' => [
+ 'local_cert' => __DIR__ . '/bug54992.pem',
+ 'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_SERVER,
+ ]]);
$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
- phpt_notify();
+ phpt_notify();
$client = stream_socket_accept($server, 1);
if (!$client) {
- exit();
- }
+ exit();
+ }
$data = '';
- while (strlen($data) < 0xfffff) {
- $buffer = fread($client, 8192);
- if (empty($buffer)) {
- exit();
- }
- $data .= $buffer;
- usleep(100);
- }
+ while (strlen($data) < 0xfffff) {
+ $buffer = fread($client, 8192);
+ if (empty($buffer)) {
+ exit();
+ }
+ $data .= $buffer;
+ usleep(100);
+ }
fclose($client);
CODE;
$clientCode = <<<'CODE'
function streamRead($stream) : int {
- return strlen(fread($stream, 8192));
- }
+ return strlen(fread($stream, 8192));
+ }
function streamWrite($stream, $data) : int {
- return fwrite($stream, $data);
- }
+ return fwrite($stream, $data);
+ }
function waitForWrite(...$streams) : bool {
- $read = null;
- $except = null;
- while($streams && !($n = stream_select($read, $streams, $except, 1)));
- return $n > 0;
- }
+ $read = null;
+ $except = null;
+ while($streams && !($n = stream_select($read, $streams, $except, 1)));
+ return $n > 0;
+ }
function waitForRead(...$streams) : bool {
- $write = null;
- $except = null;
- while ($streams && !($n = stream_select($streams, $write, $except, 1)));
- return $n > 0;
- }
+ $write = null;
+ $except = null;
+ while ($streams && !($n = stream_select($streams, $write, $except, 1)));
+ return $n > 0;
+ }
set_error_handler(function ($errno, $errstr) {
- exit("$errstr\n");
- });
+ exit("$errstr\n");
+ });
$serverUri = "tcp://127.0.0.1:10012";
- $clientFlags = STREAM_CLIENT_CONNECT;
- $clientCtx = stream_context_create(['ssl' => [
- 'verify_peer' => true,
- 'cafile' => __DIR__ . '/bug54992-ca.pem',
- 'peer_name' => 'bug54992.local',
- ]]);
+ $clientFlags = STREAM_CLIENT_CONNECT;
+ $clientCtx = stream_context_create(['ssl' => [
+ 'verify_peer' => true,
+ 'cafile' => __DIR__ . '/bug54992-ca.pem',
+ 'peer_name' => 'bug54992.local',
+ ]]);
phpt_wait();
$fp = stream_socket_client($serverUri, $errno, $errstr, 1, $clientFlags, $clientCtx);
stream_set_blocking($fp, false);
- while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
+ while (0 === ($n = stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT)));
$data = str_repeat("a", 0xfffff);
- $written = 0;
- $total = $written;
- while(!empty($data)) {
- $written = streamWrite($fp, $data);
- $total += $written;
- $data = substr($data, $written);
- waitForWrite($fp);
- }
- printf("Written %d bytes\n", $total);
+ $written = 0;
+ $total = $written;
+ while(!empty($data)) {
+ $written = streamWrite($fp, $data);
+ $total += $written;
+ $data = substr($data, $written);
+ waitForWrite($fp);
+ }
+ printf("Written %d bytes\n", $total);
while(waitForRead($fp)) {
- streamRead($fp);
- if (feof($fp)) {
- break;
- }
- }
+ streamRead($fp);
+ if (feof($fp)) {
+ break;
+ }
+ }
exit("DONE\n");
CODE;
diff --git a/ext/openssl/tests/bug74402.phpt b/ext/openssl/tests/bug74402.phpt
index db0800791b..51eec997ad 100644
--- a/ext/openssl/tests/bug74402.phpt
+++ b/ext/openssl/tests/bug74402.phpt
@@ -2,12 +2,8 @@
Bug #74402 (segfault on random_bytes, bin3hex, openssl_seal)
--SKIPIF--
<?php
-if (!extension_loaded("openssl")) {
- print "skip";
-}
-if (!in_array('AES256', openssl_get_cipher_methods(true))) {
- print "skip";
-}
+if (!extension_loaded("openssl")) print "skip";
+if (!in_array('AES256', openssl_get_cipher_methods(true))) print "skip";
?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug74720_1.phpt b/ext/openssl/tests/bug74720_1.phpt
index d85f9ba83a..eb0d1f5c56 100644
--- a/ext/openssl/tests/bug74720_1.phpt
+++ b/ext/openssl/tests/bug74720_1.phpt
@@ -1,9 +1,7 @@
--TEST--
Bug #74720 pkcs7_en/decrypt does not work if \x1a is used in content, variant 1
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug74798.phpt b/ext/openssl/tests/bug74798.phpt
index ad74b51fb4..93f6ded44d 100644
--- a/ext/openssl/tests/bug74798.phpt
+++ b/ext/openssl/tests/bug74798.phpt
@@ -1,9 +1,7 @@
--TEST--
Bug #74798 pkcs7_en/decrypt does not work if \x0a is used in content
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
diff --git a/ext/openssl/tests/bug74903.phpt b/ext/openssl/tests/bug74903.phpt
index 2dc06cc0d6..40b14f0acf 100644
--- a/ext/openssl/tests/bug74903.phpt
+++ b/ext/openssl/tests/bug74903.phpt
@@ -1,83 +1,83 @@
---TEST--
-Bug #74903 openssl_pkcs7_encrypt() uses different EOL than before
---SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
---FILE--
-<?php
-
-$cert = "-----BEGIN CERTIFICATE-----
-MIIDXDCCAkSgAwIBAgIKq/f5U3FzthdKUzANBgkqhkiG9w0BAQUFADBcMRIwEAYD
-VQQDEwlzZXRhcGRmLWExCTAHBgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcN
-AQkBFhRzdXBwb3J0QHNldGFzaWduLmNvbTELMAkGA1UEBhMCREUwHhcNMTUwOTA4
-MDkzNDExWhcNMjAwOTA4MDkzNDExWjBcMRIwEAYDVQQDEwlzZXRhcGRmLWExCTAH
-BgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QHNldGFz
-aWduLmNvbTELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
-AoIBAQCkmTLvUIYfqAKC1CHVgABlemrFIVRm4JGeB0jIGofyrm3yVwR4YcK0eUmt
-/0nbFfsFsU0/C9dXKZYD42t5YpLFsj666Z1EoU1CfSIW2bf0HaWVJ+oNT5twS3dv
-RTzAcnPM44GxO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5fFUhiXw
-VE4ifoN1Mg3+MWg3657jG66hihNd77WgU9uM3TkCgYEAypuvVrfFrrtXnbEUcBHq
-mguKumn9miD9DPb6gi8ZaKOddGzw+qFPukiqi7rM3oRMg02evfK/VQC87Gmev663
-RV9sQOlB9gNlMOOw/0R3ABEWDoSRCcrLhb6Z5Y72WVnZvpTPO0cDw2i1hyaEM6d+
-2WR7c6FhRCLxG0DObEOfiO0=
------END PRIVATE KEY-----
-";
-
-$envelopeData = "Test";
-
-$tmpFileIn = tempnam(sys_get_temp_dir(), 'test');
-$tmpFileOut = tempnam(sys_get_temp_dir(), 'test');
-file_put_contents($tmpFileIn, $envelopeData);
-
-openssl_pkcs7_encrypt($tmpFileIn, $tmpFileOut, [$cert], array(), PKCS7_BINARY, OPENSSL_CIPHER_AES_128_CBC);
-
-$result = file_get_contents($tmpFileOut);
-var_dump(strpos($result, "\r\n") === false); // behaviour before 7.2
-var_dump(strlen($result) === 847);
-
-unlink($tmpFileIn);
-unlink($tmpFileOut);
-
-?>
-==DONE==
---EXPECT--
-bool(true)
-bool(true)
-==DONE==
-
+--TEST--
+Bug #74903 openssl_pkcs7_encrypt() uses different EOL than before
+--SKIPIF--
+<?php
+if (!extension_loaded("openssl")) die("skip");
+?>
+--FILE--
+<?php
+
+$cert = "-----BEGIN CERTIFICATE-----
+MIIDXDCCAkSgAwIBAgIKq/f5U3FzthdKUzANBgkqhkiG9w0BAQUFADBcMRIwEAYD
+VQQDEwlzZXRhcGRmLWExCTAHBgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcN
+AQkBFhRzdXBwb3J0QHNldGFzaWduLmNvbTELMAkGA1UEBhMCREUwHhcNMTUwOTA4
+MDkzNDExWhcNMjAwOTA4MDkzNDExWjBcMRIwEAYDVQQDEwlzZXRhcGRmLWExCTAH
+BgNVBAoTADEJMAcGA1UECxMAMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QHNldGFz
+aWduLmNvbTELMAkGA1UEBhMCREUwggEi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2Erky0IWstsow62yWvLDyTCM+QhqlHwnh3TJVvNI1GBAoGAUl+y
+MOJ6z5Ql2aqc0UwT1i1Tlxz5s73D93Tlho1Ovp3E5Bg6OK4kt9CwMNe0IhF2GGgQ
++l1cj6kIF6Fk8cR6r46QwDM0p3a1VMPQZNx0+NFxzkot7FsuY26lJyyG5fFUhiXw
+VE4ifoN1Mg3+MWg3657jG66hihNd77WgU9uM3TkCgYEAypuvVrfFrrtXnbEUcBHq
+mguKumn9miD9DPb6gi8ZaKOddGzw+qFPukiqi7rM3oRMg02evfK/VQC87Gmev663
+RV9sQOlB9gNlMOOw/0R3ABEWDoSRCcrLhb6Z5Y72WVnZvpTPO0cDw2i1hyaEM6d+
+2WR7c6FhRCLxG0DObEOfiO0=
+-----END PRIVATE KEY-----
+";
+
+$envelopeData = "Test";
+
+$tmpFileIn = tempnam(sys_get_temp_dir(), 'test');
+$tmpFileOut = tempnam(sys_get_temp_dir(), 'test');
+file_put_contents($tmpFileIn, $envelopeData);
+
+openssl_pkcs7_encrypt($tmpFileIn, $tmpFileOut, [$cert], array(), PKCS7_BINARY, OPENSSL_CIPHER_AES_128_CBC);
+
+$result = file_get_contents($tmpFileOut);
+var_dump(strpos($result, "\r\n") === false); // behaviour before 7.2
+var_dump(strlen($result) === 847);
+
+unlink($tmpFileIn);
+unlink($tmpFileOut);
+
+?>
+==DONE==
+--EXPECT--
+bool(true)
+bool(true)
+==DONE==
+
diff --git a/ext/openssl/tests/bug76296.phpt b/ext/openssl/tests/bug76296.phpt
index 7ab15dfbf3..59a73b7d7b 100644
--- a/ext/openssl/tests/bug76296.phpt
+++ b/ext/openssl/tests/bug76296.phpt
@@ -7,7 +7,7 @@ Bug #76296 openssl_pkey_get_public does not respect open_basedir
$dir = __DIR__ . '/bug76296_openbasedir';
$pem = 'file://' . __DIR__ . '/public.key';
if (!is_dir($dir)) {
- mkdir($dir);
+ mkdir($dir);
}
ini_set('open_basedir', $dir);
diff --git a/ext/openssl/tests/capture_peer_cert_001.phpt b/ext/openssl/tests/capture_peer_cert_001.phpt
index 0396cace43..c89f7fcb0b 100644
--- a/ext/openssl/tests/capture_peer_cert_001.phpt
+++ b/ext/openssl/tests/capture_peer_cert_001.phpt
@@ -4,6 +4,7 @@ capture_peer_cert context captures on verify failure
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -35,5 +36,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
string(%d) "bug54992.local"
diff --git a/ext/openssl/tests/check_default_conf_path.phpt b/ext/openssl/tests/check_default_conf_path.phpt
index 16aaa4bc1d..71b1b6a5df 100644
--- a/ext/openssl/tests/check_default_conf_path.phpt
+++ b/ext/openssl/tests/check_default_conf_path.phpt
@@ -17,7 +17,7 @@ ob_end_clean();
preg_match(",Openssl default config .* (.*),", $info, $m);
if (isset($m[1])) {
- var_dump(str_replace('/', '\\', strtolower($m[1])));
+ var_dump(str_replace('/', '\\', strtolower($m[1])));
}
?>
--EXPECT--
diff --git a/ext/openssl/tests/cipher_tests.inc b/ext/openssl/tests/cipher_tests.inc
index b9e84af8f8..b1e46b411e 100644
--- a/ext/openssl/tests/cipher_tests.inc
+++ b/ext/openssl/tests/cipher_tests.inc
@@ -1,111 +1,111 @@
<?php
$php_openssl_cipher_tests = array(
- 'aes-256-ccm' => array(
- array(
- 'key' => '1bde3251d41a8b5ea013c195ae128b21' .
- '8b3e0306376357077ef1c1c78548b92e',
- 'iv' => '5b8e40746f6b98e00f1d13ff41',
- 'aad' => 'c17a32514eb6103f3249e076d4c871dc' .
- '97e04b286699e54491dc18f6d734d4c0',
- 'tag' => '2024931d73bca480c24a24ece6b6c2bf',
- 'pt' => '53bd72a97089e312422bf72e242377b3' .
- 'c6ee3e2075389b999c4ef7f28bd2b80a',
- 'ct' => '9a5fcccdb4cf04e7293d2775cc76a488' .
- 'f042382d949b43b7d6bb2b9864786726',
- ),
- ),
- 'aes-128-gcm' => array(
- array(
- 'key' => '00000000000000000000000000000000',
- 'iv' => '000000000000000000000000',
- 'tag' => '58e2fccefa7e3061367f1d57a4e7455a',
- 'pt' => '',
- 'ct' => '',
- ),
- array(
- 'key' => '00000000000000000000000000000000',
- 'iv' => '000000000000000000000000',
- 'tag' => 'ab6e47d42cec13bdf53a67b21257bddf',
- 'pt' => '00000000000000000000000000000000',
- 'ct' => '0388dace60b6a392f328c2b971b2fe78',
- ),
- array(
- 'key' => 'feffe9928665731c6d6a8f9467308308',
- 'iv' => 'cafebabefacedbaddecaf888',
- 'tag' => '4d5c2af327cd64a62cf35abd2ba6fab4',
- 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
- '86a7a9531534f7da2e4c303d8a318a72' .
- '1c3c0c95956809532fcf0e2449a6b525' .
- 'b16aedf5aa0de657ba637b391aafd255',
- 'ct' => '42831ec2217774244b7221b784d0d49c' .
- 'e3aa212f2c02a4e035c17e2329aca12e' .
- '21d514b25466931c7d8f6a5aac84aa05' .
- '1ba30b396a0aac973d58e091473f5985',
- ),
- array(
- 'key' => 'feffe9928665731c6d6a8f9467308308',
- 'iv' => 'cafebabefacedbaddecaf888',
- 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
- 'tag' => '5bc94fbc3221a5db94fae95ae7121a47',
- 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
- '86a7a9531534f7da2e4c303d8a318a72' .
- '1c3c0c95956809532fcf0e2449a6b525' .
- 'b16aedf5aa0de657ba637b39',
- 'ct' => '42831ec2217774244b7221b784d0d49c' .
- 'e3aa212f2c02a4e035c17e2329aca12e' .
- '21d514b25466931c7d8f6a5aac84aa05' .
- '1ba30b396a0aac973d58e091',
- ),
- array(
- 'key' => 'feffe9928665731c6d6a8f9467308308',
- 'iv' => 'cafebabefacedbad',
- 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
- 'tag' => '3612d2e79e3b0785561be14aaca2fccb',
- 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
- '86a7a9531534f7da2e4c303d8a318a72' .
- '1c3c0c95956809532fcf0e2449a6b525' .
- 'b16aedf5aa0de657ba637b39',
- 'ct' => '61353b4c2806934a777ff51fa22a4755' .
- '699b2a714fcdc6f83766e5f97b6c7423' .
- '73806900e49f24b22b097544d4896b42' .
- '4989b5e1ebac0f07c23f4598'
- ),
- array(
- 'key' => 'feffe9928665731c6d6a8f9467308308',
- 'iv' => '9313225df88406e555909c5aff5269aa' .
- '6a7a9538534f7da1e4c303d2a318a728' .
- 'c3c0c95156809539fcf0e2429a6b5254' .
- '16aedbf5a0de6a57a637b39b',
- 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
- 'tag' => '619cc5aefffe0bfa462af43c1699d050',
- 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
- '86a7a9531534f7da2e4c303d8a318a72' .
- '1c3c0c95956809532fcf0e2449a6b525' .
- 'b16aedf5aa0de657ba637b39',
- 'ct' => '8ce24998625615b603a033aca13fb894' .
- 'be9112a5c3a211a8ba262a3cca7e2ca7' .
- '01e4a9a4fba43c90ccdcb281d48c7c6f' .
- 'd62875d2aca417034c34aee5',
- ),
- )
+ 'aes-256-ccm' => array(
+ array(
+ 'key' => '1bde3251d41a8b5ea013c195ae128b21' .
+ '8b3e0306376357077ef1c1c78548b92e',
+ 'iv' => '5b8e40746f6b98e00f1d13ff41',
+ 'aad' => 'c17a32514eb6103f3249e076d4c871dc' .
+ '97e04b286699e54491dc18f6d734d4c0',
+ 'tag' => '2024931d73bca480c24a24ece6b6c2bf',
+ 'pt' => '53bd72a97089e312422bf72e242377b3' .
+ 'c6ee3e2075389b999c4ef7f28bd2b80a',
+ 'ct' => '9a5fcccdb4cf04e7293d2775cc76a488' .
+ 'f042382d949b43b7d6bb2b9864786726',
+ ),
+ ),
+ 'aes-128-gcm' => array(
+ array(
+ 'key' => '00000000000000000000000000000000',
+ 'iv' => '000000000000000000000000',
+ 'tag' => '58e2fccefa7e3061367f1d57a4e7455a',
+ 'pt' => '',
+ 'ct' => '',
+ ),
+ array(
+ 'key' => '00000000000000000000000000000000',
+ 'iv' => '000000000000000000000000',
+ 'tag' => 'ab6e47d42cec13bdf53a67b21257bddf',
+ 'pt' => '00000000000000000000000000000000',
+ 'ct' => '0388dace60b6a392f328c2b971b2fe78',
+ ),
+ array(
+ 'key' => 'feffe9928665731c6d6a8f9467308308',
+ 'iv' => 'cafebabefacedbaddecaf888',
+ 'tag' => '4d5c2af327cd64a62cf35abd2ba6fab4',
+ 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
+ '86a7a9531534f7da2e4c303d8a318a72' .
+ '1c3c0c95956809532fcf0e2449a6b525' .
+ 'b16aedf5aa0de657ba637b391aafd255',
+ 'ct' => '42831ec2217774244b7221b784d0d49c' .
+ 'e3aa212f2c02a4e035c17e2329aca12e' .
+ '21d514b25466931c7d8f6a5aac84aa05' .
+ '1ba30b396a0aac973d58e091473f5985',
+ ),
+ array(
+ 'key' => 'feffe9928665731c6d6a8f9467308308',
+ 'iv' => 'cafebabefacedbaddecaf888',
+ 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
+ 'tag' => '5bc94fbc3221a5db94fae95ae7121a47',
+ 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
+ '86a7a9531534f7da2e4c303d8a318a72' .
+ '1c3c0c95956809532fcf0e2449a6b525' .
+ 'b16aedf5aa0de657ba637b39',
+ 'ct' => '42831ec2217774244b7221b784d0d49c' .
+ 'e3aa212f2c02a4e035c17e2329aca12e' .
+ '21d514b25466931c7d8f6a5aac84aa05' .
+ '1ba30b396a0aac973d58e091',
+ ),
+ array(
+ 'key' => 'feffe9928665731c6d6a8f9467308308',
+ 'iv' => 'cafebabefacedbad',
+ 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
+ 'tag' => '3612d2e79e3b0785561be14aaca2fccb',
+ 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
+ '86a7a9531534f7da2e4c303d8a318a72' .
+ '1c3c0c95956809532fcf0e2449a6b525' .
+ 'b16aedf5aa0de657ba637b39',
+ 'ct' => '61353b4c2806934a777ff51fa22a4755' .
+ '699b2a714fcdc6f83766e5f97b6c7423' .
+ '73806900e49f24b22b097544d4896b42' .
+ '4989b5e1ebac0f07c23f4598'
+ ),
+ array(
+ 'key' => 'feffe9928665731c6d6a8f9467308308',
+ 'iv' => '9313225df88406e555909c5aff5269aa' .
+ '6a7a9538534f7da1e4c303d2a318a728' .
+ 'c3c0c95156809539fcf0e2429a6b5254' .
+ '16aedbf5a0de6a57a637b39b',
+ 'aad' => 'feedfacedeadbeeffeedfacedeadbeefabaddad2',
+ 'tag' => '619cc5aefffe0bfa462af43c1699d050',
+ 'pt' => 'd9313225f88406e5a55909c5aff5269a' .
+ '86a7a9531534f7da2e4c303d8a318a72' .
+ '1c3c0c95956809532fcf0e2449a6b525' .
+ 'b16aedf5aa0de657ba637b39',
+ 'ct' => '8ce24998625615b603a033aca13fb894' .
+ 'be9112a5c3a211a8ba262a3cca7e2ca7' .
+ '01e4a9a4fba43c90ccdcb281d48c7c6f' .
+ 'd62875d2aca417034c34aee5',
+ ),
+ )
);
function openssl_get_cipher_tests($method)
{
- global $php_openssl_cipher_tests;
+ global $php_openssl_cipher_tests;
- $tests = array();
+ $tests = array();
- foreach ($php_openssl_cipher_tests[$method] as $instance) {
- $test = array();
- foreach ($instance as $field_name => $field_value) {
- $test[$field_name] = pack("H*", $field_value);
- }
- if (!isset($test['aad'])) {
- $test['aad'] = "";
- }
- $tests[] = $test;
- }
+ foreach ($php_openssl_cipher_tests[$method] as $instance) {
+ $test = array();
+ foreach ($instance as $field_name => $field_value) {
+ $test[$field_name] = pack("H*", $field_value);
+ }
+ if (!isset($test['aad'])) {
+ $test['aad'] = "";
+ }
+ $tests[] = $test;
+ }
- return $tests;
+ return $tests;
}
diff --git a/ext/openssl/tests/cve-2013-6420.phpt b/ext/openssl/tests/cve-2013-6420.phpt
index ccead0aab6..4a4b28ca74 100644
--- a/ext/openssl/tests/cve-2013-6420.phpt
+++ b/ext/openssl/tests/cve-2013-6420.phpt
@@ -1,9 +1,7 @@
--TEST--
CVE-2013-6420
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$crt = substr(__FILE__, 0, -4).'.crt';
diff --git a/ext/openssl/tests/cve2013_4073.phpt b/ext/openssl/tests/cve2013_4073.phpt
index a626e21f95..c88021b0ae 100644
--- a/ext/openssl/tests/cve2013_4073.phpt
+++ b/ext/openssl/tests/cve2013_4073.phpt
@@ -1,14 +1,14 @@
--TEST--
CVE 2013-4073: Null-byte certificate handling
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
$cert = file_get_contents(__DIR__ . '/cve2013_4073.pem');
$info = openssl_x509_parse($cert);
var_export($info['extensions']);
+?>
--EXPECT--
array (
'basicConstraints' => 'CA:FALSE',
diff --git a/ext/openssl/tests/ecc.phpt b/ext/openssl/tests/ecc.phpt
index fda45f9edb..41567e9b32 100644
--- a/ext/openssl/tests/ecc.phpt
+++ b/ext/openssl/tests/ecc.phpt
@@ -5,16 +5,16 @@ openssl_*() with OPENSSL_KEYTYPE_EC
--FILE--
<?php
$args = array(
- "curve_name" => "secp384r1",
- "private_key_type" => OPENSSL_KEYTYPE_EC,
+ "curve_name" => "secp384r1",
+ "private_key_type" => OPENSSL_KEYTYPE_EC,
);
echo "Testing openssl_pkey_new\n";
$key1 = openssl_pkey_new($args);
var_dump($key1);
$argsFailed = array(
- "curve_name" => "invalid_cuve_name",
- "private_key_type" => OPENSSL_KEYTYPE_EC,
+ "curve_name" => "invalid_cuve_name",
+ "private_key_type" => OPENSSL_KEYTYPE_EC,
);
$keyFailed = openssl_pkey_new($argsFailed);
@@ -34,11 +34,11 @@ $d2 = openssl_pkey_get_details($key2);
var_dump($d1 === $d2);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
);
// openssl_csr_new creates a new public key pair if the key argument is null
@@ -74,9 +74,9 @@ $curve_names = openssl_get_curve_names();
var_dump(is_array($curve_names));
foreach ($curve_names as $curve_name) {
- if ("secp384r1" === $curve_name) {
- echo "Found secp384r1 in curve names\n";
- }
+ if ("secp384r1" === $curve_name) {
+ echo "Found secp384r1 in curve names\n";
+ }
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_csr_export_bacis.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt
index d3f8842e71..228a173764 100644
--- a/ext/openssl/tests/openssl_csr_export_bacis.phpt
+++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt
@@ -9,19 +9,19 @@ $config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$config_arg = array('config' => $config);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
);
$args = array(
- "digest_alg" => "sha1",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true,
- "config" => $config,
+ "digest_alg" => "sha1",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_DSA,
+ "encrypt_key" => true,
+ "config" => $config,
);
$privkey = openssl_pkey_new($config_arg);
diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
index 1576302ae3..ccbd00f49a 100644
--- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt
@@ -8,28 +8,28 @@ $csrfile = dirname(__FILE__) . "/openssl_csr_export_to_file_csr.tmp";
$wrong = "wrong";
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
- 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
- '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
- '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
+ 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
+ '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
+ '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
- 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
+ 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
);
$args = array(
- "digest_alg" => "sha1",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true,
- "config" => $config,
+ "digest_alg" => "sha1",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_DSA,
+ "encrypt_key" => true,
+ "config" => $config,
);
$privkey_file = 'file://' . dirname(__FILE__) . '/private_rsa_2048.key';
@@ -45,7 +45,7 @@ var_dump(openssl_csr_export_to_file($csr, $csrfile, false));
<?php
$csrfile = dirname(__FILE__) . "/openssl_csr_export_to_file_csr.tmp";
if (file_exists($csrfile)) {
- unlink($csrfile);
+ unlink($csrfile);
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
index e8a9b7a0ce..1958350dfb 100644
--- a/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_get_public_key_basic.phpt
@@ -8,28 +8,28 @@ if (!extension_loaded("openssl")) die("skip");
<?php
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
- 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
- '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
- '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
+ 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
+ '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
+ '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
);
$args = array(
- "digest_alg" => "sha1",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true,
- "config" => $config,
+ "digest_alg" => "sha1",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_DSA,
+ "encrypt_key" => true,
+ "config" => $config,
);
$privkey_file = 'file://' . dirname(__FILE__) . '/private_rsa_2048.key';
diff --git a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
index bfc2d3ce8d..7046085618 100644
--- a/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_get_subject_basic.phpt
@@ -8,28 +8,28 @@ if (!extension_loaded("openssl")) die("skip");
<?php
$config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
- 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
- '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
- '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
+ 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
+ '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
+ '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
);
$args = array(
- "digest_alg" => "sha1",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true,
- "config" => $config,
+ "digest_alg" => "sha1",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_DSA,
+ "encrypt_key" => true,
+ "config" => $config,
);
$privkey_file = 'file://' . dirname(__FILE__) . '/private_rsa_2048.key';
diff --git a/ext/openssl/tests/openssl_csr_sign_basic.phpt b/ext/openssl/tests/openssl_csr_sign_basic.phpt
index a9961c2357..4a8e9dd67f 100644
--- a/ext/openssl/tests/openssl_csr_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_csr_sign_basic.phpt
@@ -12,20 +12,20 @@ $config = __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf';
$config_arg = array('config' => $config);
$dn = array(
- "countryName" => "BR",
- "stateOrProvinceName" => "Rio Grande do Sul",
- "localityName" => "Porto Alegre",
- "commonName" => "Henrique do N. Angelo",
- "emailAddress" => "hnangelo@php.net"
- );
+ "countryName" => "BR",
+ "stateOrProvinceName" => "Rio Grande do Sul",
+ "localityName" => "Porto Alegre",
+ "commonName" => "Henrique do N. Angelo",
+ "emailAddress" => "hnangelo@php.net"
+);
$args = array(
- "digest_alg" => "sha1",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_DSA,
- "encrypt_key" => true,
- "config" => $config
- );
+ "digest_alg" => "sha1",
+ "private_key_bits" => 2048,
+ "private_key_type" => OPENSSL_KEYTYPE_DSA,
+ "encrypt_key" => true,
+ "config" => $config
+);
$privkey = openssl_pkey_new($config_arg);
$csr = openssl_csr_new($dn, $privkey, $args);
diff --git a/ext/openssl/tests/openssl_decrypt_ccm.phpt b/ext/openssl/tests/openssl_decrypt_ccm.phpt
index 83278e093e..a5f01b87ce 100644
--- a/ext/openssl/tests/openssl_decrypt_ccm.phpt
+++ b/ext/openssl/tests/openssl_decrypt_ccm.phpt
@@ -14,10 +14,10 @@ $method = 'aes-256-ccm';
$tests = openssl_get_cipher_tests($method);
foreach ($tests as $idx => $test) {
- echo "TEST $idx\n";
- $pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $test['tag'], $test['aad']);
- var_dump($test['pt'] === $pt);
+ echo "TEST $idx\n";
+ $pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
+ $test['iv'], $test['tag'], $test['aad']);
+ var_dump($test['pt'] === $pt);
}
// no IV
diff --git a/ext/openssl/tests/openssl_decrypt_gcm.phpt b/ext/openssl/tests/openssl_decrypt_gcm.phpt
index f7002ed51b..f03c4d2468 100644
--- a/ext/openssl/tests/openssl_decrypt_gcm.phpt
+++ b/ext/openssl/tests/openssl_decrypt_gcm.phpt
@@ -14,10 +14,10 @@ $method = 'aes-128-gcm';
$tests = openssl_get_cipher_tests($method);
foreach ($tests as $idx => $test) {
- echo "TEST $idx\n";
- $pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $test['tag'], $test['aad']);
- var_dump($test['pt'] === $pt);
+ echo "TEST $idx\n";
+ $pt = openssl_decrypt($test['ct'], $method, $test['key'], OPENSSL_RAW_DATA,
+ $test['iv'], $test['tag'], $test['aad']);
+ var_dump($test['pt'] === $pt);
}
// no IV
diff --git a/ext/openssl/tests/openssl_encrypt_ccm.phpt b/ext/openssl/tests/openssl_encrypt_ccm.phpt
index 945e81dfd7..c8610bc96b 100644
--- a/ext/openssl/tests/openssl_encrypt_ccm.phpt
+++ b/ext/openssl/tests/openssl_encrypt_ccm.phpt
@@ -3,9 +3,9 @@ openssl_encrypt() with CCM cipher algorithm tests
--SKIPIF--
<?php
if (!extension_loaded("openssl"))
- die("skip");
+ die("skip");
if (!in_array('aes-256-ccm', openssl_get_cipher_methods()))
- die("skip: aes-256-ccm not available");
+ die("skip: aes-256-ccm not available");
?>
--FILE--
<?php
@@ -14,11 +14,11 @@ $method = 'aes-256-ccm';
$tests = openssl_get_cipher_tests($method);
foreach ($tests as $idx => $test) {
- echo "TEST $idx\n";
- $ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $tag, $test['aad'], strlen($test['tag']));
- var_dump($test['ct'] === $ct);
- var_dump($test['tag'] === $tag);
+ echo "TEST $idx\n";
+ $ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
+ $test['iv'], $tag, $test['aad'], strlen($test['tag']));
+ var_dump($test['ct'] === $ct);
+ var_dump($test['tag'] === $tag);
}
// Empty IV error
diff --git a/ext/openssl/tests/openssl_encrypt_gcm.phpt b/ext/openssl/tests/openssl_encrypt_gcm.phpt
index 60b48cd091..e2be510980 100644
--- a/ext/openssl/tests/openssl_encrypt_gcm.phpt
+++ b/ext/openssl/tests/openssl_encrypt_gcm.phpt
@@ -14,11 +14,11 @@ $method = 'aes-128-gcm';
$tests = openssl_get_cipher_tests($method);
foreach ($tests as $idx => $test) {
- echo "TEST $idx\n";
- $ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
- $test['iv'], $tag, $test['aad'], strlen($test['tag']));
- var_dump($test['ct'] === $ct);
- var_dump($test['tag'] === $tag);
+ echo "TEST $idx\n";
+ $ct = openssl_encrypt($test['pt'], $method, $test['key'], OPENSSL_RAW_DATA,
+ $test['iv'], $tag, $test['aad'], strlen($test['tag']));
+ var_dump($test['ct'] === $ct);
+ var_dump($test['tag'] === $tag);
}
// Empty IV error
diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt
index 69b05572e0..06ce195ae0 100644
--- a/ext/openssl/tests/openssl_error_string_basic.phpt
+++ b/ext/openssl/tests/openssl_error_string_basic.phpt
@@ -6,35 +6,35 @@ openssl_error_string() tests
<?php
// helper function to check openssl errors
function expect_openssl_errors($name, $expected_error_codes) {
- $expected_errors = array_fill_keys($expected_error_codes, false);
- while (($error_string = openssl_error_string()) !== false) {
- if (strlen($error_string) > 14) {
- $error_code = substr($error_string, 6, 8);
- if (isset($expected_errors[$error_code])) {
- $expected_errors[$error_code] = true;
- }
- }
- }
+ $expected_errors = array_fill_keys($expected_error_codes, false);
+ while (($error_string = openssl_error_string()) !== false) {
+ if (strlen($error_string) > 14) {
+ $error_code = substr($error_string, 6, 8);
+ if (isset($expected_errors[$error_code])) {
+ $expected_errors[$error_code] = true;
+ }
+ }
+ }
- $fail = false;
- foreach ($expected_errors as $error_code => $error_code_found) {
- if (!$error_code_found) {
- $fail = true;
- echo "$name: no error code $error_code\n";
- }
- }
+ $fail = false;
+ foreach ($expected_errors as $error_code => $error_code_found) {
+ if (!$error_code_found) {
+ $fail = true;
+ echo "$name: no error code $error_code\n";
+ }
+ }
- if (!$fail) {
- echo "$name: ok\n";
- }
+ if (!$fail) {
+ echo "$name: ok\n";
+ }
}
// helper for debugging errors
function dump_openssl_errors($name) {
- echo "\n$name\n";
- while (($error_string = openssl_error_string()) !== false) {
- var_dump($error_string);
- }
+ echo "\n$name\n";
+ while (($error_string = openssl_error_string()) !== false) {
+ var_dump($error_string);
+ }
}
// common output file
@@ -71,10 +71,10 @@ for ($i = 0; $i < 20; $i++) {
}
$error_queue_size = 0;
while (($enc_error_new = openssl_error_string()) !== false) {
- if ($enc_error_new !== $enc_error) {
- echo "The new encoding error doesn't match the expected one\n";
- }
- ++$error_queue_size;
+ if ($enc_error_new !== $enc_error) {
+ echo "The new encoding error doesn't match the expected one\n";
+ }
+ ++$error_queue_size;
}
var_dump($error_queue_size);
echo "\n";
diff --git a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
index 743233579a..430de54dfd 100644
--- a/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
+++ b/ext/openssl/tests/openssl_peer_fingerprint_basic.phpt
@@ -4,6 +4,7 @@ Testing peer fingerprint on connection
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -44,6 +45,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
Warning: stream_socket_client(): peer_fingerprint match failure in %s on line %d
diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
index cf6c0df8ac..623126fc59 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_basic.phpt
@@ -8,11 +8,11 @@ $infile = dirname(__FILE__) . "/cert.crt";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
$encrypted = tempnam(sys_get_temp_dir(), "ssl");
if ($encrypted === false)
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
$outfile = tempnam(sys_get_temp_dir(), "ssl");
if ($outfile === false) {
- unlink($outfile);
- die("failed to get a temporary filename!");
+ unlink($outfile);
+ die("failed to get a temporary filename!");
}
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
@@ -33,12 +33,12 @@ var_dump(openssl_pkcs7_decrypt($encrypted, $outfile, $empty, $privkey));
var_dump(openssl_pkcs7_decrypt($encrypted, $outfile, $single_cert, $empty));
if (file_exists($encrypted)) {
- echo "true\n";
- unlink($encrypted);
+ echo "true\n";
+ unlink($encrypted);
}
if (file_exists($outfile)) {
- echo "true\n";
- unlink($outfile);
+ echo "true\n";
+ unlink($outfile);
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
index b51205bb53..3e76efe22d 100644
--- a/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_decrypt_error.phpt
@@ -6,7 +6,7 @@ openssl_pkcs7_decrypt() and invalid parameters
<?php
function myErrorHandler($errno, $errstr, $errfile, $errline) {
- var_dump($errstr);
+ var_dump($errstr);
}
set_error_handler("myErrorHandler");
diff --git a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
index 210e5de934..2132b402aa 100644
--- a/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
@@ -7,10 +7,10 @@ openssl_pkcs7_encrypt() tests
$infile = dirname(__FILE__) . "/cert.crt";
$outfile = tempnam(sys_get_temp_dir(), "ssl");
if ($outfile === false)
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
$outfile2 = tempnam(sys_get_temp_dir(), "ssl");
if ($outfile2 === false)
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
@@ -37,12 +37,12 @@ var_dump(openssl_pkcs7_encrypt($infile, $outfile, $multi_certs, $headers));
var_dump(openssl_pkcs7_encrypt($infile, $outfile, array_map('openssl_x509_read', $multi_certs) , $headers));
if (file_exists($outfile)) {
- echo "true\n";
- unlink($outfile);
+ echo "true\n";
+ unlink($outfile);
}
if (file_exists($outfile2)) {
- echo "true\n";
- unlink($outfile2);
+ echo "true\n";
+ unlink($outfile2);
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
index d6ce799848..0e29901c7e 100644
--- a/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
+++ b/ext/openssl/tests/openssl_pkcs7_sign_basic.phpt
@@ -7,7 +7,7 @@ openssl_pkcs7_sign() tests
$infile = dirname(__FILE__) . "/cert.crt";
$outfile = tempnam(sys_get_temp_dir(), "ssl");
if ($outfile === false) {
- die("failed to get a temporary filename!");
+ die("failed to get a temporary filename!");
}
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
@@ -32,8 +32,8 @@ var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $privkey, $empty));
var_dump(openssl_pkcs7_sign($infile, $outfile, $single_cert, $wrong, $headers));
if (file_exists($outfile)) {
- echo "true\n";
- unlink($outfile);
+ echo "true\n";
+ unlink($outfile);
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_pkey_new_basic.phpt b/ext/openssl/tests/openssl_pkey_new_basic.phpt
index b73b1f580c..41e67b2a04 100644
--- a/ext/openssl/tests/openssl_pkey_new_basic.phpt
+++ b/ext/openssl/tests/openssl_pkey_new_basic.phpt
@@ -10,30 +10,30 @@ function openssl_pkey_test_cmp($expected, $bin_key) {
// RSA
$nhex = "BBF82F090682CE9C2338AC2B9DA871F7368D07EED41043A440D6B6F07454F51F" .
- "B8DFBAAF035C02AB61EA48CEEB6FCD4876ED520D60E1EC4619719D8A5B8B807F" .
- "AFB8E0A3DFC737723EE6B4B7D93A2584EE6A649D060953748834B2454598394E" .
- "E0AAB12D7B61A51F527A9A41F6C1687FE2537298CA2A8F5946F8E5FD091DBDCB";
+ "B8DFBAAF035C02AB61EA48CEEB6FCD4876ED520D60E1EC4619719D8A5B8B807F" .
+ "AFB8E0A3DFC737723EE6B4B7D93A2584EE6A649D060953748834B2454598394E" .
+ "E0AAB12D7B61A51F527A9A41F6C1687FE2537298CA2A8F5946F8E5FD091DBDCB";
$ehex = "11";
$dhex = "A5DAFC5341FAF289C4B988DB30C1CDF83F31251E0668B42784813801579641B2" .
- "9410B3C7998D6BC465745E5C392669D6870DA2C082A939E37FDCB82EC93EDAC9" .
- "7FF3AD5950ACCFBC111C76F1A9529444E56AAF68C56C092CD38DC3BEF5D20A93" .
- "9926ED4F74A13EDDFBE1A1CECC4894AF9428C2B7B8883FE4463A4BC85B1CB3C1";
+ "9410B3C7998D6BC465745E5C392669D6870DA2C082A939E37FDCB82EC93EDAC9" .
+ "7FF3AD5950ACCFBC111C76F1A9529444E56AAF68C56C092CD38DC3BEF5D20A93" .
+ "9926ED4F74A13EDDFBE1A1CECC4894AF9428C2B7B8883FE4463A4BC85B1CB3C1";
$phex = "EECFAE81B1B9B3C908810B10A1B5600199EB9F44AEF4FDA493B81A9E3D84F632" .
- "124EF0236E5D1E3B7E28FAE7AA040A2D5B252176459D1F397541BA2A58FB6599";
+ "124EF0236E5D1E3B7E28FAE7AA040A2D5B252176459D1F397541BA2A58FB6599";
$qhex = "C97FB1F027F453F6341233EAAAD1D9353F6C42D08866B1D05A0F2035028B9D86" .
- "9840B41666B42E92EA0DA3B43204B5CFCE3352524D0416A5A441E700AF461503";
+ "9840B41666B42E92EA0DA3B43204B5CFCE3352524D0416A5A441E700AF461503";
$rsa= openssl_pkey_new(array(
- 'rsa' => array(
- 'n' => hex2bin($nhex),
- 'e' => hex2bin($ehex),
- 'd' => hex2bin($dhex),
- 'p' => hex2bin($phex),
- 'q' => hex2bin($qhex),
- )
+ 'rsa' => array(
+ 'n' => hex2bin($nhex),
+ 'e' => hex2bin($ehex),
+ 'd' => hex2bin($dhex),
+ 'p' => hex2bin($phex),
+ 'q' => hex2bin($qhex),
+ )
));
$details = openssl_pkey_get_details($rsa);
$rsa_details = $details['rsa'];
@@ -45,24 +45,24 @@ openssl_pkey_test_cmp($qhex, $rsa_details['q']);
// DSA
$phex = '00f8000ae45b2dacb47dd977d58b719d097bdf07cb2c17660ad898518c08' .
- '1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
- '24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
- '1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
- '996def90090303b7ad';
+ '1a61659a16daadfaa406a0a994c743df5eda07e36bd0adcad921b77432ff' .
+ '24ccc31e782d647e66768122b578857e9293df78387dc8b44af2a4a3f305' .
+ '1f236b1000a3e31da489c6681b0031f7ec37c2e1091bdb698e7660f135b6' .
+ '996def90090303b7ad';
$qhex = '009b3734fc9f7a4a9d6437ec314e0a78c2889af64b';
$ghex = '00b320300a0bc55b8f0ec6edc218e2185250f38fbb8291db8a89227f6e41' .
- '00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
- 'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
- '4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
- 'b81747c4c447a941f3';
+ '00d47d6ccb9c7d42fc43280ecc2ed386e81ff65bc5d6a2ae78db7372f5dc' .
+ 'f780f4558e7ed3dd0c96a1b40727ac56c5165aed700a3b63997893a1fb21' .
+ '4e882221f0dd9604820dc34e2725dd6901c93e0ca56f6d76d495c332edc5' .
+ 'b81747c4c447a941f3';
$dsa = openssl_pkey_new(array(
- 'dsa' => array(
- 'p' => hex2bin($phex),
- 'q' => hex2bin($qhex),
- 'g' => hex2bin($ghex)
- )
+ 'dsa' => array(
+ 'p' => hex2bin($phex),
+ 'q' => hex2bin($qhex),
+ 'g' => hex2bin($ghex)
+ )
));
$details = openssl_pkey_get_details($dsa);
$dsa_details = $details['dsa'];
@@ -74,13 +74,13 @@ var_dump(strlen($dsa_details['pub_key']));
// DH
$phex = 'dcf93a0b883972ec0e19989ac5a2ce310e1d37717e8d9571bb7623731866e61e' .
- 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
- '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
- '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
+ 'f75a2e27898b057f9891c2e27a639c3f29b60814581cd3b2ca3986d268370557' .
+ '7d45c2e7e52dc81c7a171876e5cea74b1448bfdfaf18828efd2519f14e45e382' .
+ '6634af1949e5b535cc829a483b8a76223e5d490a257f05bdff16f2fb22c583ab';
$dh_details = array('p' => $phex, 'g' => '2');
$dh = openssl_pkey_new(array(
- 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
+ 'dh'=> array('p' => hex2bin($phex), 'g' => '2'))
);
$details = openssl_pkey_get_details($dh);
$dh_details = $details['dh'];
diff --git a/ext/openssl/tests/openssl_private_encrypt_basic.phpt b/ext/openssl/tests/openssl_private_encrypt_basic.phpt
index a2a5152158..968537c3c3 100644
--- a/ext/openssl/tests/openssl_private_encrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_private_encrypt_basic.phpt
@@ -10,9 +10,9 @@ $pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
class test {
- function __toString() {
- return "test";
- }
+ function __toString() {
+ return "test";
+ }
}
$obj = new test;
diff --git a/ext/openssl/tests/openssl_public_encrypt_basic.phpt b/ext/openssl/tests/openssl_public_encrypt_basic.phpt
index a3c4c57539..e9d47c26b0 100644
--- a/ext/openssl/tests/openssl_public_encrypt_basic.phpt
+++ b/ext/openssl/tests/openssl_public_encrypt_basic.phpt
@@ -10,9 +10,9 @@ $pubkey = "file://" . dirname(__FILE__) . "/public.key";
$wrong = "wrong";
class test {
- function __toString() {
- return "test";
- }
+ function __toString() {
+ return "test";
+ }
}
$obj = new test;
diff --git a/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt b/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt
index ac5a3079a1..68c11dde2c 100644
--- a/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt
+++ b/ext/openssl/tests/openssl_random_pseudo_bytes_basic.phpt
@@ -5,7 +5,7 @@ openssl_random_pseudo_bytes() tests
--FILE--
<?php
for ($i = 0; $i < 10; $i++) {
- var_dump(bin2hex(openssl_random_pseudo_bytes($i, $strong)));
+ var_dump(bin2hex(openssl_random_pseudo_bytes($i, $strong)));
}
?>
diff --git a/ext/openssl/tests/openssl_spki_export_basic.phpt b/ext/openssl/tests/openssl_spki_export_basic.phpt
index 1e3bd1fd39..8871c1016d 100644
--- a/ext/openssl/tests/openssl_spki_export_basic.phpt
+++ b/ext/openssl/tests/openssl_spki_export_basic.phpt
@@ -12,39 +12,39 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
- $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
- $pkeys[] = openssl_pkey_get_private($key_file);
+ $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
+ $pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
- OPENSSL_ALGO_MD4,
- OPENSSL_ALGO_MD5,
- OPENSSL_ALGO_SHA1,
- OPENSSL_ALGO_SHA224,
- OPENSSL_ALGO_SHA256,
- OPENSSL_ALGO_SHA384,
- OPENSSL_ALGO_SHA512,
- OPENSSL_ALGO_RMD160
+ OPENSSL_ALGO_MD4,
+ OPENSSL_ALGO_MD5,
+ OPENSSL_ALGO_SHA1,
+ OPENSSL_ALGO_SHA224,
+ OPENSSL_ALGO_SHA256,
+ OPENSSL_ALGO_SHA384,
+ OPENSSL_ALGO_SHA512,
+ OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
- /* loop to create and verify results */
- foreach ($algo as $value) {
- $spkac = openssl_spki_new($pkey, _uuid(), $value);
- echo openssl_spki_export(preg_replace('/SPKAC=/', '', $spkac));
- }
+ /* loop to create and verify results */
+ foreach ($algo as $value) {
+ $spkac = openssl_spki_new($pkey, _uuid(), $value);
+ echo openssl_spki_export(preg_replace('/SPKAC=/', '', $spkac));
+ }
}
/* generate a random challenge */
function _uuid() {
- return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff));
+ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
+ mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
diff --git a/ext/openssl/tests/openssl_spki_export_challenge_basic.phpt b/ext/openssl/tests/openssl_spki_export_challenge_basic.phpt
index 07a69d3b45..2b947221bb 100644
--- a/ext/openssl/tests/openssl_spki_export_challenge_basic.phpt
+++ b/ext/openssl/tests/openssl_spki_export_challenge_basic.phpt
@@ -14,40 +14,40 @@ if (!@openssl_pkey_new()) die("skip cannot create private key");
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
- $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
- $pkeys[] = openssl_pkey_get_private($key_file);
+ $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
+ $pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
- OPENSSL_ALGO_MD4,
- OPENSSL_ALGO_MD5,
- OPENSSL_ALGO_SHA1,
- OPENSSL_ALGO_SHA224,
- OPENSSL_ALGO_SHA256,
- OPENSSL_ALGO_SHA384,
- OPENSSL_ALGO_SHA512,
- OPENSSL_ALGO_RMD160
+ OPENSSL_ALGO_MD4,
+ OPENSSL_ALGO_MD5,
+ OPENSSL_ALGO_SHA1,
+ OPENSSL_ALGO_SHA224,
+ OPENSSL_ALGO_SHA256,
+ OPENSSL_ALGO_SHA384,
+ OPENSSL_ALGO_SHA512,
+ OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
- /* loop to create and verify results */
- foreach ($algo as $value) {
- $spkac = openssl_spki_new($pkey, _uuid(), $value);
- var_dump(openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $spkac)));
- var_dump(openssl_spki_export_challenge($spkac . 'Make it fail'));
- }
+ /* loop to create and verify results */
+ foreach ($algo as $value) {
+ $spkac = openssl_spki_new($pkey, _uuid(), $value);
+ var_dump(openssl_spki_export_challenge(preg_replace('/SPKAC=/', '', $spkac)));
+ var_dump(openssl_spki_export_challenge($spkac . 'Make it fail'));
+ }
}
/* generate a random challenge */
function _uuid() {
- return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff));
+ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
+ mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
diff --git a/ext/openssl/tests/openssl_spki_new_basic.phpt b/ext/openssl/tests/openssl_spki_new_basic.phpt
index b31d6f9184..7f9e023618 100644
--- a/ext/openssl/tests/openssl_spki_new_basic.phpt
+++ b/ext/openssl/tests/openssl_spki_new_basic.phpt
@@ -11,38 +11,38 @@ if (!extension_loaded("openssl")) die("skip");
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
- $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
- $pkeys[] = openssl_pkey_get_private($key_file);
+ $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
+ $pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
- OPENSSL_ALGO_MD4,
- OPENSSL_ALGO_MD5,
- OPENSSL_ALGO_SHA1,
- OPENSSL_ALGO_SHA224,
- OPENSSL_ALGO_SHA256,
- OPENSSL_ALGO_SHA384,
- OPENSSL_ALGO_SHA512,
- OPENSSL_ALGO_RMD160
+ OPENSSL_ALGO_MD4,
+ OPENSSL_ALGO_MD5,
+ OPENSSL_ALGO_SHA1,
+ OPENSSL_ALGO_SHA224,
+ OPENSSL_ALGO_SHA256,
+ OPENSSL_ALGO_SHA384,
+ OPENSSL_ALGO_SHA512,
+ OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
- /* loop to create and verify results */
- foreach ($algo as $value) {
- var_dump(openssl_spki_new($pkey, _uuid(), $value));
- }
+ /* loop to create and verify results */
+ foreach ($algo as $value) {
+ var_dump(openssl_spki_new($pkey, _uuid(), $value));
+ }
}
/* generate a random challenge */
function _uuid() {
- return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff));
+ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
+ mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
?>
diff --git a/ext/openssl/tests/openssl_spki_verify_basic.phpt b/ext/openssl/tests/openssl_spki_verify_basic.phpt
index 7b56a37e13..4abfc1798c 100644
--- a/ext/openssl/tests/openssl_spki_verify_basic.phpt
+++ b/ext/openssl/tests/openssl_spki_verify_basic.phpt
@@ -13,38 +13,38 @@ if (!extension_loaded("openssl")) die("skip");
$key_sizes = array(1024, 2048, 4096);
$pkeys = array();
foreach ($key_sizes as $key_size) {
- $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
- $pkeys[] = openssl_pkey_get_private($key_file);
+ $key_file = "file://" . dirname(__FILE__) . "/private_rsa_" . $key_size . ".key";
+ $pkeys[] = openssl_pkey_get_private($key_file);
}
/* array of available hashings to test */
$algo = array(
- OPENSSL_ALGO_SHA1,
- OPENSSL_ALGO_SHA224,
- OPENSSL_ALGO_SHA256,
- OPENSSL_ALGO_SHA384,
- OPENSSL_ALGO_SHA512,
- OPENSSL_ALGO_RMD160
+ OPENSSL_ALGO_SHA1,
+ OPENSSL_ALGO_SHA224,
+ OPENSSL_ALGO_SHA256,
+ OPENSSL_ALGO_SHA384,
+ OPENSSL_ALGO_SHA512,
+ OPENSSL_ALGO_RMD160
);
/* loop over key sizes for test */
foreach ($pkeys as $pkey) {
- /* loop to create and verify results */
- foreach ($algo as $value) {
- $spkac = openssl_spki_new($pkey, _uuid(), $value);
- var_dump(openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac)));
- var_dump(openssl_spki_verify($spkac . 'Make it fail'));
- }
+ /* loop to create and verify results */
+ foreach ($algo as $value) {
+ $spkac = openssl_spki_new($pkey, _uuid(), $value);
+ var_dump(openssl_spki_verify(preg_replace('/SPKAC=/', '', $spkac)));
+ var_dump(openssl_spki_verify($spkac . 'Make it fail'));
+ }
}
/* generate a random challenge */
function _uuid() {
- return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
- mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
- mt_rand(0, 0xffff), mt_rand(0, 0xffff));
+ return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000,
+ mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff),
+ mt_rand(0, 0xffff), mt_rand(0, 0xffff));
}
diff --git a/ext/openssl/tests/openssl_x509_export_basic.phpt b/ext/openssl/tests/openssl_x509_export_basic.phpt
index 4177bd7798..94cb4fa48c 100644
--- a/ext/openssl/tests/openssl_x509_export_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_basic.phpt
@@ -19,7 +19,7 @@ var_dump(openssl_x509_export($d, $output4)); // read cert from a resource
var_dump(openssl_x509_export($e, $output5)); // read an array, fails
if (PHP_EOL !== "\n") {
- $a = str_replace(PHP_EOL, "\n", $a);
+ $a = str_replace(PHP_EOL, "\n", $a);
}
var_dump(strcmp($output, $a));
diff --git a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
index 68ba93230d..04e6d9e565 100644
--- a/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_export_to_file_basic.phpt
@@ -25,7 +25,7 @@ var_dump($exists = file_exists($outfilename));
<?php
$outfilename = dirname(__FILE__) . "/openssl_x509_export_to_file__outfilename.tmp";
if (file_exists($outfilename)) {
- unlink($outfilename);
+ unlink($outfilename);
}
?>
--EXPECTF--
diff --git a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
index add65cb3e3..f47255ac1b 100644
--- a/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_fingerprint_basic.phpt
@@ -1,9 +1,7 @@
--TEST--
openssl_x509_fingerprint() tests
--SKIPIF--
-<?php
-if (!extension_loaded("openssl")) die("skip");
-?>
+<?php if (!extension_loaded("openssl")) die("skip"); ?>
--FILE--
<?php
diff --git a/ext/openssl/tests/openssl_x509_parse_basic.phpt b/ext/openssl/tests/openssl_x509_parse_basic.phpt
index 65cc062e40..8c04b791fc 100644
--- a/ext/openssl/tests/openssl_x509_parse_basic.phpt
+++ b/ext/openssl/tests/openssl_x509_parse_basic.phpt
@@ -1,9 +1,7 @@
--TEST--
openssl_x509_parse() tests
--SKIPIF--
-<?php if (!extension_loaded("openssl")) print "skip";
-if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0");
-?>
+<?php if (!extension_loaded("openssl")) print "skip"; ?>
--FILE--
<?php
$cert = "file://" . dirname(__FILE__) . "/cert.crt";
diff --git a/ext/openssl/tests/peer_verification.phpt b/ext/openssl/tests/peer_verification.phpt
index 6aff34ddd8..3abc191667 100644
--- a/ext/openssl/tests/peer_verification.phpt
+++ b/ext/openssl/tests/peer_verification.phpt
@@ -4,6 +4,7 @@ Peer verification enabled for client streams
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -54,6 +55,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
bool(false)
bool(false)
diff --git a/ext/openssl/tests/san_peer_matching.phpt b/ext/openssl/tests/san_peer_matching.phpt
index 0e1f30cb64..f048c4e0f1 100644
--- a/ext/openssl/tests/san_peer_matching.phpt
+++ b/ext/openssl/tests/san_peer_matching.phpt
@@ -4,6 +4,7 @@ Peer verification matches SAN names
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -39,6 +40,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/session_meta_capture.phpt b/ext/openssl/tests/session_meta_capture.phpt
index 76182e17d5..733bde82ae 100644
--- a/ext/openssl/tests/session_meta_capture.phpt
+++ b/ext/openssl/tests/session_meta_capture.phpt
@@ -4,7 +4,7 @@ Capture SSL session meta array in stream context
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -53,6 +53,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
string(5) "TLSv1"
string(7) "TLSv1.1"
diff --git a/ext/openssl/tests/sni_server.phpt b/ext/openssl/tests/sni_server.phpt
index d55c5d69a1..76ea4f7325 100644
--- a/ext/openssl/tests/sni_server.phpt
+++ b/ext/openssl/tests/sni_server.phpt
@@ -3,6 +3,8 @@ sni_server
--SKIPIF--
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
+if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -54,6 +56,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
string(%d) "cs.php.net"
string(%d) "uk.php.net"
diff --git a/ext/openssl/tests/stream_crypto_flags_001.phpt b/ext/openssl/tests/stream_crypto_flags_001.phpt
index 1ba930936f..d65220c128 100644
--- a/ext/openssl/tests/stream_crypto_flags_001.phpt
+++ b/ext/openssl/tests/stream_crypto_flags_001.phpt
@@ -4,6 +4,7 @@ Basic bitwise stream crypto context flag assignment
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -41,6 +42,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/stream_crypto_flags_002.phpt b/ext/openssl/tests/stream_crypto_flags_002.phpt
index e57f2b7069..379736dd81 100644
--- a/ext/openssl/tests/stream_crypto_flags_002.phpt
+++ b/ext/openssl/tests/stream_crypto_flags_002.phpt
@@ -4,7 +4,7 @@ TLSv1.1 and TLSv1.2 bitwise stream crypto flag assignment
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -49,6 +49,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/stream_crypto_flags_004.phpt b/ext/openssl/tests/stream_crypto_flags_004.phpt
index e51a2bab3e..8ebeb9a304 100644
--- a/ext/openssl/tests/stream_crypto_flags_004.phpt
+++ b/ext/openssl/tests/stream_crypto_flags_004.phpt
@@ -4,6 +4,7 @@ Specific protocol method specification
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -53,6 +54,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
bool(false)
diff --git a/ext/openssl/tests/stream_server_reneg_limit.phpt b/ext/openssl/tests/stream_server_reneg_limit.phpt
index d355505e54..f0353351a2 100644
--- a/ext/openssl/tests/stream_server_reneg_limit.phpt
+++ b/ext/openssl/tests/stream_server_reneg_limit.phpt
@@ -7,7 +7,7 @@ if (!function_exists("proc_open")) die("skip no proc_open");
exec('openssl help', $out, $code);
if ($code > 0) die("skip couldn't locate openssl binary");
if(substr(PHP_OS, 0, 3) == 'WIN') {
- die('skip not suitable for Windows');
+ die('skip not suitable for Windows');
}
?>
--FILE--
@@ -85,5 +85,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($serverCode, $clientCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/stream_verify_peer_name_001.phpt b/ext/openssl/tests/stream_verify_peer_name_001.phpt
index 4aecf8c744..e39994b12f 100644
--- a/ext/openssl/tests/stream_verify_peer_name_001.phpt
+++ b/ext/openssl/tests/stream_verify_peer_name_001.phpt
@@ -4,6 +4,7 @@ Verify host name by default in client transfers
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -35,5 +36,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/stream_verify_peer_name_002.phpt b/ext/openssl/tests/stream_verify_peer_name_002.phpt
index cfee8b1c07..01081bf5a0 100644
--- a/ext/openssl/tests/stream_verify_peer_name_002.phpt
+++ b/ext/openssl/tests/stream_verify_peer_name_002.phpt
@@ -4,6 +4,7 @@ Allow host name mismatch when "verify_host" disabled
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -36,5 +37,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
diff --git a/ext/openssl/tests/stream_verify_peer_name_003.phpt b/ext/openssl/tests/stream_verify_peer_name_003.phpt
index e4e083f7f6..3865453262 100644
--- a/ext/openssl/tests/stream_verify_peer_name_003.phpt
+++ b/ext/openssl/tests/stream_verify_peer_name_003.phpt
@@ -4,6 +4,7 @@ Host name mismatch triggers error
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -35,6 +36,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
Warning: stream_socket_client(): Peer certificate CN=`bug54992.local' did not match expected CN=`127.0.0.1' in %s on line %d
diff --git a/ext/openssl/tests/streams_crypto_method.phpt b/ext/openssl/tests/streams_crypto_method.phpt
index 15d0598e0f..3816aa1195 100644
--- a/ext/openssl/tests/streams_crypto_method.phpt
+++ b/ext/openssl/tests/streams_crypto_method.phpt
@@ -4,7 +4,7 @@ Specific crypto method for ssl:// transports.
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSLv1.0.1 required");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -49,5 +49,6 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECT--
Hello World!
diff --git a/ext/openssl/tests/tlsv1.0_wrapper.phpt b/ext/openssl/tests/tlsv1.0_wrapper.phpt
index c0477dfe32..952a288305 100644
--- a/ext/openssl/tests/tlsv1.0_wrapper.phpt
+++ b/ext/openssl/tests/tlsv1.0_wrapper.phpt
@@ -4,6 +4,7 @@ tlsv1.0 stream wrapper
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -41,6 +42,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
bool(false)
diff --git a/ext/openssl/tests/tlsv1.1_wrapper.phpt b/ext/openssl/tests/tlsv1.1_wrapper.phpt
index a5dba299ec..eedf54fea7 100644
--- a/ext/openssl/tests/tlsv1.1_wrapper.phpt
+++ b/ext/openssl/tests/tlsv1.1_wrapper.phpt
@@ -4,7 +4,7 @@ tlsv1.1 stream wrapper
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSL 1.0.1 required");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -42,6 +42,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
bool(false)
diff --git a/ext/openssl/tests/tlsv1.2_wrapper.phpt b/ext/openssl/tests/tlsv1.2_wrapper.phpt
index 42980cf661..3d7b3ba26c 100644
--- a/ext/openssl/tests/tlsv1.2_wrapper.phpt
+++ b/ext/openssl/tests/tlsv1.2_wrapper.phpt
@@ -4,7 +4,7 @@ tlsv1.2 stream wrapper
<?php
if (!extension_loaded("openssl")) die("skip openssl not loaded");
if (!function_exists("proc_open")) die("skip no proc_open");
-if (OPENSSL_VERSION_NUMBER < 0x10001001) die("skip OpenSSL 1.0.1 required");
+?>
--FILE--
<?php
$serverCode = <<<'CODE'
@@ -42,6 +42,7 @@ CODE;
include 'ServerClientTestCase.inc';
ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
+?>
--EXPECTF--
resource(%d) of type (stream)
bool(false)