1--TEST--
2openssl_verify() tests
3--EXTENSIONS--
4openssl
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, OPENSSL_ALGO_SHA256);
13var_dump(openssl_verify($data, $sign, $pubkey, OPENSSL_ALGO_SHA256));
14var_dump(openssl_verify($data, $sign, $privkey, OPENSSL_ALGO_SHA256));
15var_dump(openssl_verify($data, $sign, $wrong, OPENSSL_ALGO_SHA256));
16var_dump(openssl_verify($data, $wrong, $pubkey, OPENSSL_ALGO_SHA256));
17var_dump(openssl_verify($wrong, $sign, $pubkey, OPENSSL_ALGO_SHA256));
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