略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: openssl_x509_fingerprint

2024-04-29

openssl_x509_fingerprint

(PHP 5 >= 5.6.0, PHP 7, PHP 8)

openssl_x509_fingerprint计算一个给定的x.509证书的指纹或摘要

说明

openssl_x509_fingerprint(mixed $x509, string $hash_algorithm = "sha1", bool $raw_output = false): string

openssl_x509_fingerprint() 返回x509的字符串类型的摘要。

参数

x509

参见密钥/证书参数以获取有效值列表。

hash_algorithm

使用的摘要方法或散列算法,比如, "sha256", openssl_get_md_methods()摘要算法之一。

raw_output

设置为 true时,输出原始二进制数据。设置为 false时,输出小写的16进制字符串。

返回值

将包含计算的证书指纹的字符串返回为小写16进制格式,除非将raw_output设置为TRUE,在这种情况下会返回消息摘要的原始二进制表示形式。

失败则返回 false .

add a noteadd a note

User Contributed Notes 1 note

up
-20
nb at dland dot de
7 years ago
The manual is not constistent at this point. On one hand, it describes the return as digest/fingerprint of a cert, on the other hand it says:
bool openssl_x509_fingerprint( … )

On PHP 5.6.5, I only get the bool return (1 or 0).

官方地址:https://www.php.net/manual/en/function.openssl-x509-fingerprint.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3