xref: /PHP-5.4/ext/openssl/tests/009.phpt (revision 15823900)
1--TEST--
2openssl_x509_check_private_key() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7$fp = fopen(dirname(__FILE__) . "/cert.crt","r");
8$a = fread($fp,8192);
9fclose($fp);
10
11$fp = fopen(dirname(__FILE__) . "/private.key","r");
12$b = fread($fp,8192);
13fclose($fp);
14
15$cert = "file://" . dirname(__FILE__) . "/cert.crt";
16$key = "file://" . dirname(__FILE__) . "/private.key";
17
18var_dump(openssl_x509_check_private_key($cert, $key));
19var_dump(openssl_x509_check_private_key("", $key));
20var_dump(openssl_x509_check_private_key($cert, ""));
21var_dump(openssl_x509_check_private_key("", ""));
22var_dump(openssl_x509_check_private_key($a, $b));
23?>
24--EXPECT--
25bool(true)
26bool(false)
27bool(false)
28bool(false)
29bool(true)
30