xref: /PHP-5.4/ext/openssl/tests/019.phpt (revision 15823900)
1--TEST--
2openssl_verify() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7$data = "Testing openssl_verify()";
8$privkey = "file://" . dirname(__FILE__) . "/private.key";
9$pubkey = "file://" . dirname(__FILE__) . "/public.key";
10$wrong = "wrong";
11
12openssl_sign($data, $sign, $privkey);
13var_dump(openssl_verify($data, $sign, $pubkey));
14var_dump(openssl_verify($data, $sign, $privkey));
15var_dump(openssl_verify($data, $sign, $wrong));
16var_dump(openssl_verify($data, $wrong, $pubkey));
17var_dump(openssl_verify($wrong, $sign, $pubkey));
18?>
19--EXPECTF--
20int(1)
21
22Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
23bool(false)
24
25Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
26bool(false)
27int(0)
28int(0)
29