summaryrefslogtreecommitdiff
path: root/ext/openssl/tests/019.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/tests/019.phpt')
-rw-r--r--ext/openssl/tests/019.phpt28
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/openssl/tests/019.phpt b/ext/openssl/tests/019.phpt
new file mode 100644
index 0000000..c1f186c
--- /dev/null
+++ b/ext/openssl/tests/019.phpt
@@ -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.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)