[英]How to verify certificates (not self signed) using PHP
I have received two files and I am supposed to validate using PHP ! 我已经收到两个文件,应该使用PHP进行验证!
One file starts with
-----BEGIN CERTIFICATE-----
一个文件以
-----BEGIN CERTIFICATE-----
开头and ends with
-----END CERTIFICATE-----
并以
-----END CERTIFICATE-----
结尾The second file starts with
-----BEGIN RSA PRIVATE KEY-----
第二个文件以
-----BEGIN RSA PRIVATE KEY-----
开头and ends with
-----END RSA PRIVATE KEY-----
并以
-----END RSA PRIVATE KEY-----
结尾
Kindly note that the domains are not online yet but I need to find out how to get the domain names by using these two files. 请注意,这些域名尚未在线,但是我需要找出如何通过使用这两个文件来获取域名的方法。
The solution that I found is to use this in PHP: 我发现的解决方案是在PHP中使用它:
$contents = file_get_contents($certificate_file_path);
$ contents = file_get_contents($ certificate_file_path);
$parsed = openssl_x509_parse($contents);
$ parsed = openssl_x509_parse($ contents);
print_r($parsed);
print_r($ parsed);
This will give you every associated information in an array format. 这将为您提供数组格式的所有关联信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.