Annotation of embedaddon/php/ext/openssl/tests/014.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: openssl_private_encrypt() tests
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("openssl")) print "skip"; ?>
                      5: --FILE--
                      6: <?php
                      7: $data = "Testing openssl_private_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_private_encrypt($data, $encrypted, $privkey));
                     19: var_dump(openssl_private_encrypt($data, $encrypted, $pubkey));
                     20: var_dump(openssl_private_encrypt($data, $encrypted, $wrong));
                     21: var_dump(openssl_private_encrypt($data, $encrypted, $obj));
                     22: var_dump(openssl_private_encrypt($obj, $encrypted, $privkey));
                     23: openssl_public_decrypt($encrypted, $output, $pubkey);
                     24: var_dump($output);
                     25: ?>
                     26: --EXPECTF--
                     27: bool(true)
                     28: 
                     29: Warning: openssl_private_encrypt(): key param is not a valid private key in %s on line %d
                     30: bool(false)
                     31: 
                     32: Warning: openssl_private_encrypt(): key param is not a valid private key in %s on line %d
                     33: bool(false)
                     34: 
                     35: Warning: openssl_private_encrypt(): key param is not a valid private key in %s on line %d
                     36: bool(false)
                     37: bool(true)
                     38: string(4) "test"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>