mirror of
https://github.com/php/php-src.git
synced 2024-12-24 01:09:58 +08:00
Fix tests
This commit is contained in:
parent
745b5695e0
commit
6e211dc4af
@ -19,7 +19,7 @@ var_dump(openssl_pkcs7_decrypt($a, $b, $c, $d));
|
||||
var_dump($c);
|
||||
|
||||
var_dump(openssl_pkcs7_decrypt($b, $b, $b, $b));
|
||||
var_dump(openssl_pkcs7_decrypt($a, $b, "", ""));
|
||||
var_dump(openssl_pkcs7_decrypt($a, $b, b"", b""));
|
||||
var_dump(openssl_pkcs7_decrypt($a, $b, true, false));
|
||||
var_dump(openssl_pkcs7_decrypt($a, $b, 0, 0));
|
||||
|
||||
|
@ -8,7 +8,7 @@ $data = b"openssl_open() test";
|
||||
$pub_key = "file://" . dirname(__FILE__) . "/public.key";
|
||||
$wrong = "wrong";
|
||||
|
||||
openssl_seal($data, $sealed, $ekeys, array($pub_key));
|
||||
openssl_seal($data, $sealed, $ekeys, array($pub_key)); // no output
|
||||
openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key)); // no output
|
||||
openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong));
|
||||
openssl_seal($data, $sealed, $ekeys, array($pub_key, (binary)$wrong));
|
||||
@ -19,6 +19,8 @@ openssl_seal($data, $sealed, $ekeys, array($wrong));
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
||||
Warning: openssl_seal(): Binary string expected, Unicode string received in %s on line %d
|
||||
|
||||
Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
|
||||
|
||||
Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
|
||||
@ -29,5 +31,7 @@ Warning: openssl_seal() expects parameter 4 to be array, binary string given in
|
||||
|
||||
Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
|
||||
|
||||
Warning: openssl_seal(): Binary string expected, Unicode string received in %s on line %d
|
||||
|
||||
Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
|
||||
|
||||
|
@ -4,12 +4,12 @@ openssl_pkcs7_encrypt() tests
|
||||
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = (binary) (dirname(__FILE__) . "/cert.crt");
|
||||
$outfile = (binary) tempnam(b"/tmp", b"ssl");
|
||||
$infile = dirname(__FILE__) . "/cert.crt";
|
||||
$outfile = tempnam(b"/tmp", b"ssl");
|
||||
if ($outfile === false)
|
||||
die("failed to get a temporary filename!");
|
||||
|
||||
$single_cert = (binary) ("file://" . dirname(__FILE__) . "/cert.crt");
|
||||
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
|
||||
$multi_certs = array($single_cert, $single_cert);
|
||||
$assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_encrypt()");
|
||||
$assoc_headers_bin = array(b"To" => b"test@test", b"Subject" => b"testing openssl_pkcs7_encrypt()");
|
||||
@ -48,6 +48,10 @@ bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_pkcs7_encrypt(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
|
||||
|
||||
Warning: openssl_pkcs7_encrypt(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, Unicode string given in %s on line %d
|
||||
@ -55,6 +59,8 @@ bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_pkcs7_encrypt(): Binary string expected, Unicode string received in %s on line %d
|
||||
bool(false)
|
||||
bool(false)
|
||||
bool(false)
|
||||
|
@ -4,13 +4,13 @@ openssl_pkcs7_sign() tests
|
||||
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$infile = (binary) (dirname(__FILE__) . "/cert.crt");
|
||||
$outfile = (binary) tempnam(b"/tmp", b"ssl");
|
||||
$infile = dirname(__FILE__) . "/cert.crt";
|
||||
$outfile = tempnam(b"/tmp", b"ssl");
|
||||
if ($outfile === false)
|
||||
die("failed to get a temporary filename!");
|
||||
|
||||
$privkey = (binary) ("file://" . dirname(__FILE__) . "/private.key");
|
||||
$single_cert = (binary) ("file://" . dirname(__FILE__) . "/cert.crt");
|
||||
$privkey = "file://" . dirname(__FILE__) . "/private.key";
|
||||
$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
|
||||
$assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_sign()");
|
||||
$assoc_headers_bin = array(b"To" => b"test@test", b"Subject" => b"testing openssl_pkcs7_sign()");
|
||||
$headers = array("test@test", "testing openssl_pkcs7_sign()");
|
||||
@ -49,6 +49,10 @@ bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_pkcs7_sign(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
|
||||
|
||||
Warning: openssl_pkcs7_sign(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
|
||||
bool(true)
|
||||
|
||||
Warning: openssl_pkcs7_sign() expects parameter 5 to be array, Unicode string given in %s on line %d
|
||||
@ -63,6 +67,8 @@ bool(false)
|
||||
Warning: openssl_pkcs7_sign(): error opening output file %s in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_pkcs7_sign(): Binary string expected, Unicode string received in %s on line %d
|
||||
|
||||
Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
|
||||
bool(false)
|
||||
|
||||
@ -75,6 +81,8 @@ bool(false)
|
||||
Warning: openssl_pkcs7_sign() expects parameter 5 to be array, binary string given in %s on line %d
|
||||
NULL
|
||||
|
||||
Warning: openssl_pkcs7_sign(): Binary string expected, Unicode string received in %s on line %d
|
||||
|
||||
Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d
|
||||
bool(false)
|
||||
|
||||
|
@ -18,7 +18,7 @@ $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";
|
||||
$data = b"some custom data";
|
||||
if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
|
||||
echo "openssl_sign failed.";
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ if (!extension_loaded("openssl")) die("skip");
|
||||
--FILE--
|
||||
<?php
|
||||
$pub_key_id = false;
|
||||
$signature = '';
|
||||
$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
|
||||
$signature = b'';
|
||||
$ok = openssl_verify(b"foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
|
||||
|
||||
class test {
|
||||
function __toString() {
|
||||
@ -18,11 +18,11 @@ class test {
|
||||
$t = new test;
|
||||
|
||||
|
||||
var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify(b"foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify(b"foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify(b"foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify(b"foo", new stdClass, array(), OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify(b"foo", array(), array(), OPENSSL_ALGO_MD5));
|
||||
var_dump(openssl_verify());
|
||||
var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
|
||||
|
||||
@ -39,17 +39,17 @@ Warning: openssl_verify(): supplied key param cannot be coerced into a public ke
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify() expects parameter 2 to be binary string, object given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify() expects parameter 2 to be binary string, object given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify() expects parameter 2 to be binary string, array given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify() expects parameter 1 to be binary string, object given in %s on line %d
|
||||
NULL
|
||||
bool(false)
|
||||
Done
|
||||
|
@ -14,7 +14,7 @@ class test {
|
||||
}
|
||||
$t = new test;
|
||||
|
||||
var_dump(openssl_x509_parse("foo"));
|
||||
var_dump(openssl_x509_parse(b"foo"));
|
||||
var_dump(openssl_x509_parse($t));
|
||||
var_dump(openssl_x509_parse(array()));
|
||||
var_dump(openssl_x509_parse());
|
||||
|
Loading…
Reference in New Issue
Block a user