openssl_pkey_get_details

FunctionParams and return types changed in PHP 8.0

Returns an array with the key details.

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

openssl_pkey_get_details Function synopsis

openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false

Parameters

$key

TypeOpenSSLAsymmetricKey

Resource holding the key.

Return value

Typearray|false

Returns an array with the key details on success or false on failure. Returned array has indexes bits (number of bits), key (string representation of the public key) and type (type of the key which is one of OPENSSL_KEYTYPE_RSA, OPENSSL_KEYTYPE_DSA, OPENSSL_KEYTYPE_DH, OPENSSL_KEYTYPE_EC, OPENSSL_KEYTYPE_X25519, OPENSSL_KEYTYPE_ED25519, OPENSSL_KEYTYPE_X448, OPENSSL_KEYTYPE_ED448, or -1 meaning unknown).

Depending on the key type used, additional details may be returned. Note that some elements may not always be available.

Changes to the openssl_pkey_get_details Function

PHP 8.0

  • Return type added: array|false
  • Parameter type added for parameter #1 ($key): OpenSSLAsymmetricKey
- openssl_pkey_get_details($key)
+ openssl_pkey_get_details(OpenSSLAsymmetricKey $key): array|false

openssl_pkey_get_details 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