CakeFest 2024: The Official CakePHP Conference

openssl_x509_fingerprint

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

openssl_x509_fingerprint与えられた X.509 証明書のフィンガープリントあるいはダイジェストを計算する

説明

openssl_x509_fingerprint(OpenSSLCertificate|string $certificate, string $digest_algo = "sha1", bool $binary = false): string|false

openssl_x509_fingerprint()certificate のダイジェストを文字列で返します。

パラメータ

x509

使用できる値の一覧は キー/証明書パラメータ を参照ください。

digest_algo

"sha256" といったダイジェストメソッド、またはハッシュアルゴリズム。 有効な値の一覧は、openssl_get_md_methods() で得られます。

binary

true が設定された場合、生のバイナリデータを出力します。false では小文字の8進数を出力します。

戻り値

binarytrue に設定されていない場合、小文字の8進数として計算された証明書のフィンガープリントを含む文字列を返します。 binarytrue に設定されている場合、メッセージダイジェストの生のバイナリ表現が返されます。

失敗したときは false を返します。

変更履歴

バージョン 説明
8.0.0 certificate は、 OpenSSLCertificate クラスのインスタンスを受け入れるようになりました。 これより前のバージョンでは、 OpenSSL X.509 型のリソースを受け入れていました。
add a note

User Contributed Notes 1 note

up
-22
nb at dland dot de
8 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).
To Top