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$method = "RC4"; 13 14var_dump(openssl_seal($a, $b, $c, $d, $method)); 15 16try { 17 var_dump(openssl_seal($a, $a, $a, array(), $method)); 18} catch (\ValueError $e) { 19 echo $e->getMessage() . \PHP_EOL; 20} 21 22// tests with cert 23$data = "openssl_open() test"; 24$pub_key = "file://" . __DIR__ . "/public.key"; 25$wrong = "wrong"; 26 27var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key), $method)); // no output 28var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key), $method)); // no output 29var_dump(openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong), $method)); 30 31try { 32 var_dump(openssl_seal($data, $sealed, $ekeys, array(), $method)); 33} catch (\ValueError $e) { 34 echo $e->getMessage() . \PHP_EOL; 35} 36 37var_dump(openssl_seal($data, $sealed, $ekeys, array($wrong), $method)); 38 39?> 40--EXPECTF-- 41Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d 42bool(false) 43openssl_seal(): Argument #4 ($public_key) cannot be empty 44int(19) 45int(19) 46 47Warning: openssl_seal(): Not a public key (2th member of pubkeys) in %s on line %d 48bool(false) 49openssl_seal(): Argument #4 ($public_key) cannot be empty 50 51Warning: openssl_seal(): Not a public key (1th member of pubkeys) in %s on line %d 52bool(false) 53