1--TEST-- 2openssl_private_decrypt() tests 3--SKIPIF-- 4<?php if (!extension_loaded("openssl")) print "skip"; ?> 5--FILE-- 6<?php 7$data = "Testing openssl_public_decrypt()"; 8$privkey = "file://" . dirname(__FILE__) . "/private.key"; 9$pubkey = "file://" . dirname(__FILE__) . "/public.key"; 10$wrong = "wrong"; 11 12openssl_public_encrypt($data, $encrypted, $pubkey); 13var_dump(openssl_private_decrypt($encrypted, $output, $privkey)); 14var_dump($output); 15var_dump(openssl_private_decrypt($encrypted, $output2, $wrong)); 16var_dump($output2); 17var_dump(openssl_private_decrypt($wrong, $output3, $privkey)); 18var_dump($output3); 19var_dump(openssl_private_decrypt($encrypted, $output4, array($privkey))); 20var_dump($output4); 21var_dump(openssl_private_decrypt($encrypted, $output5, array($privkey, ""))); 22var_dump($output5); 23?> 24--EXPECTF-- 25bool(true) 26string(32) "Testing openssl_public_decrypt()" 27 28Warning: openssl_private_decrypt(): key parameter is not a valid private key in %s on line %d 29bool(false) 30NULL 31bool(false) 32NULL 33 34Warning: openssl_private_decrypt(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d 35 36Warning: openssl_private_decrypt(): key parameter is not a valid private key in %s on line %d 37bool(false) 38NULL 39bool(true) 40string(32) "Testing openssl_public_decrypt()" 41