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://" . __DIR__ . "/private_rsa_1024.key";
9$pubkey = "file://" . __DIR__ . "/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