1--TEST--
2openssl_seal() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7// simple tests
8$a = 1;
9$b = array(1);
10$c = array(1);
11$d = array(1);
12
13var_dump(openssl_seal($a, $b, $c, $d));
14var_dump(openssl_seal($a, $a, $a, array()));
15var_dump(openssl_seal($c, $c, $c, 1));
16var_dump(openssl_seal($b, $b, $b, ""));
17
18// tests with cert
19$data = "openssl_open() test";
20$pub_key = "file://" . dirname(__FILE__) . "/public.key";
21$wrong = "wrong";
22
23var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key)));                  // no output
24var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key)));        // no output
25var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong)));
26var_dump(openssl_seal($data, $sealed, $ekeys, $pub_key));
27var_dump(openssl_seal($data, $sealed, $ekeys, array()));
28var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong)));
29
30echo "Done\n";
31?>
32--EXPECTF--
33Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
34bool(false)
35
36Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
37bool(false)
38
39Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
40NULL
41
42Warning: openssl_seal() expects parameter 1 to be string, array given in %s on line %d
43NULL
44int(19)
45int(19)
46
47Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
48bool(false)
49
50Warning: openssl_seal() expects parameter 4 to be array, string given in %s on line %d
51NULL
52
53Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
54bool(false)
55
56Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
57bool(false)
58Done
59