I'm having a Certificate and I wish to read the SHA 1 Fingerprint
and SHA 256 Fingerprint
from a file path.
<?php
ini_set("display_startup_errors", 1);
ini_set("display_errors", 1);
error_reporting(-1);
$certificate = "./wwwbbminfocom.crt";
$cert = openssl_x509_read($certificate);
$sha1_hash = openssl_x509_fingerprint($cert); // sha1 hash
$md5_hash = openssl_x509_fingerprint($cert, 'md5'); // md5 hash
?>
Note: I downloaded a SSL Certificate from the website https://www.bbminfo.com/Tutor/php_error_error_log.php
I got an following PHP Warning:
Warning: openssl_x509_read(): supplied parameter cannot be coerced into an X509 certificate! in /home/super/public_html/md.php on line 8
Warning: openssl_x509_fingerprint(): cannot get cert from parameter 1 in /home/super/public_html/md.php on line 9
Warning: openssl_x509_fingerprint(): cannot get cert from parameter 1 in /home/super/public_html/md.php on line 10
Kindly assist me how to read the file and get the Fingerprint. I'm using PHP 7.0