1--TEST--
2openssl_x509_check_private_key() tests
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$fp = fopen(__DIR__ . "/cert.crt","r");
8$a = fread($fp, 8192);
9fclose($fp);
10
11$fp = fopen(__DIR__ . "/private_rsa_1024.key","r");
12$b = fread($fp, 8192);
13fclose($fp);
14
15$cert = "file://" . __DIR__ . "/cert.crt";
16$key = "file://" . __DIR__ . "/private_rsa_1024.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(openssl_x509_read($a), $b));
23?>
24--EXPECT--
25bool(true)
26bool(false)
27bool(false)
28bool(false)
29bool(true)
30