1--TEST-- 2openssl_x509_verify() 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__ . "/public.key","r"); 12$b = fread($fp, 8192); 13fclose($fp); 14 15$cert = "file://" . __DIR__ . "/cert.crt"; 16$key = "file://" . __DIR__ . "/public.key"; 17$wrongKey = "file://" . __DIR__ . "/public_rsa_2048.key"; 18 19var_dump(openssl_x509_verify($cert, $key)); 20var_dump(openssl_x509_verify("", $key)); 21var_dump(openssl_x509_verify($cert, "")); 22var_dump(openssl_x509_verify("", "")); 23var_dump(openssl_x509_verify(openssl_x509_read($a), $b)); 24var_dump(openssl_x509_verify($cert, $wrongKey)); 25?> 26--EXPECT-- 27int(1) 28int(-1) 29int(-1) 30int(-1) 31int(1) 32int(0) 33