Skip to content

Commit be0758b

Browse files
committed
Extend openssl_x509_fingerprint test to cover resource cert with sha1
1 parent cfa8858 commit be0758b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/openssl/tests/openssl_x509_fingerprint_basic.phpt

+7
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@ var_dump(openssl_x509_fingerprint($cert, 'md5'));
2121
echo "**Testing raw output md5 **\n";
2222
var_dump(bin2hex(openssl_x509_fingerprint($cert, 'md5', true)));
2323

24+
echo "** Testing hash method sha1 with resource **\n";
25+
$r = openssl_x509_read($cert);
26+
var_dump(openssl_x509_fingerprint($r, 'sha1'));
27+
2428
echo "** Testing bad certification **\n";
2529
var_dump(openssl_x509_fingerprint('123'));
2630
echo "** Testing bad hash method **\n";
2731
var_dump(openssl_x509_fingerprint($cert, 'xx45'));
32+
?>
2833
--EXPECTF--
2934
** Testing with no parameters **
3035

@@ -36,6 +41,8 @@ string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
3641
string(32) "ac77008e172897e06c0b065294487a67"
3742
**Testing raw output md5 **
3843
string(32) "ac77008e172897e06c0b065294487a67"
44+
** Testing hash method sha1 with resource **
45+
string(40) "6e6fd1ea10a5a23071d61c728ee9b40df6dbc33c"
3946
** Testing bad certification **
4047

4148
Warning: openssl_x509_fingerprint(): cannot get cert from parameter 1 in %s on line %d

0 commit comments

Comments
 (0)