openssl_spki_new

FunctionMisc changes in PHP 8.2

Generate a new signed public key and challenge.

PHP 5.3-5.5
PHP 5.6
Added
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_spki_new Function synopsis

openssl_spki_new(
    OpenSSLAsymmetricKey $private_key,
    string $challenge,
    int $digest_algo = OPENSSL_ALGO_MD5
  ): string|false

Parameters

$private_key

TypeOpenSSLAsymmetricKey

$private_key should be set to a private key that was previously generated by openssl_pkey_new (or otherwise obtained from the other openssl_pkey family of functions). The corresponding public portion of the key will be used to sign the CSR.

$challenge

Typestring

The challenge associated to associate with the SPKAC

$digest_algo

OptionalTypeintDefault valueOPENSSL_ALGO_MD5

The digest algorithm. See openssl_get_md_method().

Return value

Typestring|false

Returns a signed public key and challenge string or false on failure.

Changes to the openssl_spki_new Function

PHP 8.2

PHP 8.0

  • Return type added: string|false
  • Parameter name of parameter #1 changed: $privkey to $private_key
  • Parameter type added for parameter #1 ($private_key): OpenSSLAsymmetricKey
  • Parameter type added for parameter #2 ($challenge): string
  • Parameter name of parameter #3 changed: $algo to $digest_algo
  • Parameter type added for parameter #3 ($digest_algo): int
  • Parameter default value added for position #3 ($digest_algo): OPENSSL_ALGO_MD5
  openssl_spki_new(
-     $privkey,
+     OpenSSLAsymmetricKey $private_key,
-     $challenge,
+     string $challenge,
-     $algo
+     int $digest_algo = OPENSSL_ALGO_MD5
-   )
+   ): string|false

PHP 5.6

  • Function added

openssl_spki_new 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 No
PHP 5.4Unsupported No
PHP 5.3Unsupported No