mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-20 07:16:24 +08:00
Add PHP Extension for GmSSL
View http://gmssl.org/docs/php-api.html for more info.
This commit is contained in:
28
php/ext/openssl/tests/openssl_verify_basic.phpt
Normal file
28
php/ext/openssl/tests/openssl_verify_basic.phpt
Normal file
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
openssl_verify() tests
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("openssl")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
$data = "Testing openssl_verify()";
|
||||
$privkey = "file://" . dirname(__FILE__) . "/private_rsa_1024.key";
|
||||
$pubkey = "file://" . dirname(__FILE__) . "/public.key";
|
||||
$wrong = "wrong";
|
||||
|
||||
openssl_sign($data, $sign, $privkey);
|
||||
var_dump(openssl_verify($data, $sign, $pubkey));
|
||||
var_dump(openssl_verify($data, $sign, $privkey));
|
||||
var_dump(openssl_verify($data, $sign, $wrong));
|
||||
var_dump(openssl_verify($data, $wrong, $pubkey));
|
||||
var_dump(openssl_verify($wrong, $sign, $pubkey));
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(1)
|
||||
|
||||
Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: openssl_verify(): supplied key param cannot be coerced into a public key in %s on line %d
|
||||
bool(false)
|
||||
int(0)
|
||||
int(0)
|
||||
Reference in New Issue
Block a user