Annotation of embedaddon/php/ext/openssl/tests/015.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: openssl_public_encrypt() tests
3: --SKIPIF--
4: <?php if (!extension_loaded("openssl")) print "skip"; ?>
5: --FILE--
6: <?php
7: $data = "Testing openssl_public_encrypt()";
8: $privkey = "file://" . dirname(__FILE__) . "/private.key";
9: $pubkey = "file://" . dirname(__FILE__) . "/public.key";
10: $wrong = "wrong";
11: class test {
12: function __toString() {
13: return "test";
14: }
15: }
16: $obj = new test;
17:
18: var_dump(openssl_public_encrypt($data, $encrypted, $pubkey));
19: var_dump(openssl_public_encrypt($data, $encrypted, $privkey));
20: var_dump(openssl_public_encrypt($data, $encrypted, $wrong));
21: var_dump(openssl_public_encrypt($data, $encrypted, $obj));
22: var_dump(openssl_public_encrypt($obj, $encrypted, $pubkey));
23: openssl_private_decrypt($encrypted, $output, $privkey);
24: var_dump($output);
25: ?>
26: --EXPECTF--
27: bool(true)
28:
29: Warning: openssl_public_encrypt(): key parameter is not a valid public key in %s on line %d
30: bool(false)
31:
32: Warning: openssl_public_encrypt(): key parameter is not a valid public key in %s on line %d
33: bool(false)
34:
35: Warning: openssl_public_encrypt(): key parameter is not a valid public key in %s on line %d
36: bool(false)
37: bool(true)
38: string(4) "test"
39:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>