xref: /PHP-5.4/ext/openssl/tests/013.phpt (revision 15823900)
1--TEST--
2openssl_open() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7$data = "openssl_open() test";
8$pub_key = "file://" . dirname(__FILE__) . "/public.key";
9$priv_key = "file://" . dirname(__FILE__) . "/private.key";
10$wrong = "wrong";
11
12openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key, $pub_key));
13openssl_open($sealed, $output, $ekeys[0], $priv_key);
14var_dump($output);
15openssl_open($sealed, $output2, $ekeys[1], $wrong);
16var_dump($output2);
17openssl_open($sealed, $output3, $ekeys[2], $priv_key);
18var_dump($output3);
19openssl_open($sealed, $output4, $wrong, $priv_key);
20var_dump($output4);
21?>
22--EXPECTF--
23string(19) "openssl_open() test"
24
25Warning: openssl_open(): unable to coerce parameter 4 into a private key in %s on line %d
26NULL
27string(19) "openssl_open() test"
28NULL
29