openssl_x509_verify

FunctionParams and return types changed in PHP 8.0

Verifies digital signature of x509 certificate against a public key.

PHP 5
PHP 7.0-7.3
PHP 7.4
Added
PHP 8.0
Improved
PHP 8.1
PHP 8.2
PHP 8.3
PHP 8.4
PHP 8.5

openssl_x509_verify Function synopsis

openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key): int

Parameters

$certificate

TypeOpenSSLCertificate|string

$public_key

OpenSSLAsymmetricKey - a key, returned by openssl_get_publickey

Return value

Typeint

Returns 1 if the signature is correct, 0 if it is incorrect, and -1 on error.

Changes to the openssl_x509_verify Function

PHP 8.0

  • Return type added: int
  • Parameter name of parameter #1 changed: $cert to $certificate
  • Parameter type added for parameter #1 ($certificate): OpenSSLCertificate|string
  • Parameter name of parameter #2 changed: $key to $public_key
- openssl_x509_verify($cert, $key)
+ openssl_x509_verify(OpenSSLCertificate|string $certificate, $public_key): int

PHP 7.4

  • Function added

openssl_x509_verify Function Availability

PHP VersionAvailability
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 No
PHP 7.2Unsupported No
PHP 7.1Unsupported No
PHP 7.0Unsupported No
PHP 5.6Unsupported No
PHP 5.5Unsupported No
PHP 5.4Unsupported No
PHP 5.3Unsupported No