openssl_dh_compute_key

FunctionMisc changes in PHP 8.2

Computes shared secret for public value of remote DH public key and local DH key.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2
Changed
PHP 8.3
PHP 8.4
PHP 8.5
PHP 8.6

openssl_dh_compute_key Function synopsis

openssl_dh_compute_key(string $public_key, OpenSSLAsymmetricKey $private_key): string|false

Parameters

$public_key

Typestring

DH Public key of the remote party.

$private_key

TypeOpenSSLAsymmetricKey

A local DH private key, corresponding to the public key to be shared with the remote party.

Return value

Typestring|false

Returns shared secret on success or false on failure.

Changes to the openssl_dh_compute_key Function

PHP 8.2

PHP 8.0

  • Return type added: string|false
  • Parameter name of parameter #1 changed: $pub_key to $public_key
  • Parameter type added for parameter #1 ($public_key): string
  • Parameter name of parameter #2 changed: $dh_key to $private_key
  • Parameter type added for parameter #2 ($private_key): OpenSSLAsymmetricKey
- openssl_dh_compute_key($pub_key, $dh_key)
+ openssl_dh_compute_key(string $public_key, OpenSSLAsymmetricKey $private_key): string|false

openssl_dh_compute_key Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported 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 Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes