openssl_x509_fingerprint
Function • Params and return types changed in PHP 8.0
Calculates the fingerprint, or digest, of a given X.509 certificate.
openssl_x509_fingerprint
Function synopsis
openssl_x509_fingerprint(
OpenSSLCertificate|string $certificate,
string $digest_algo = "sha1",
bool $binary = false
): string|false
Parameters
$certificate
TypeOpenSSLCertificate|string
$digest_algo
OptionalTypestring
Default value"sha1"
The digest method or hash algorithm to use, e.g. "sha256", one of openssl_get_md_methods
.
$binary
OptionalTypebool
Default valuefalse
When set to true
, outputs raw binary data. false
outputs lowercase hexits.
Return value
Typestring|false
Returns a string containing the calculated certificate fingerprint as lowercase hexits unless $binary
is set to true
in which case the raw binary representation of the message digest is returned.
Returns `false` on failure.
Changes to the openssl_x509_fingerprint
Function
PHP 8.0
- Return type added:
string|false
- Parameter name of parameter #1 changed:
$x509
to$certificate
- Parameter type added for parameter #1 (
$certificate
):OpenSSLCertificate|string
- Parameter name of parameter #2 changed:
$method
to$digest_algo
- Parameter type added for parameter #2 (
$digest_algo
):string
- Parameter default value added for position #2 (
$digest_algo
):"sha1"
- Parameter name of parameter #3 changed:
$raw_output
to$binary
- Parameter type added for parameter #3 (
$binary
):bool
- Parameter default value added for position #3 (
$binary
):false
openssl_x509_fingerprint(
- $x509,
+ OpenSSLCertificate|string $certificate,
- $method,
+ string $digest_algo = "sha1",
- $raw_output
+ bool $binary = false
- )
+ ): string|false
PHP 5.6
- Function added
openssl_x509_fingerprint
Function Availability
openssl_x509_fingerprint
Function AvailabilityPHP Version | Availability |
---|---|
PHP 8.5Future Release | Yes |
PHP 8.4Upcoming Release | Yes |
PHP 8.3Supported (Latest) | Yes |
PHP 8.2Supported | Yes |
PHP 8.1Security-Fixes Only | Yes |
PHP 8.0Unsupported | Yes |
PHP 7.4Unsupported | Yes |
PHP 7.3Unsupported | Yes |
PHP 7.2Unsupported | Yes |
PHP 7.1Unsupported | Yes |
PHP 7.0Unsupported | Yes |
PHP 5.6Unsupported | Yes |
PHP 5.5Unsupported | No |
PHP 5.4Unsupported | No |
PHP 5.3Unsupported | No |