openssl_open

FunctionMisc changes in PHP 8.2

Open sealed data.

PHP 5
PHP 7.0
Improved
PHP 7.1-7.4
PHP 8.0
Improved
PHP 8.1
PHP 8.2
Changed
PHP 8.3
PHP 8.4
PHP 8.5
PHP 8.6

openssl_open Function synopsis

openssl_open(
    string $data,
    &$output,
    string $encrypted_key,
    $private_key,
    string $cipher_algo,
    ?string $iv = null
  ): bool

Parameters

$data

Typestring

The sealed data.

$output

Passed by reference

If the call is successful the opened data is returned in this parameter.

$encrypted_key

Typestring

The encrypted symmetric key that can be decrypted using $private_key.

$private_key

The private key used for decrypting $encrypted_key.

$cipher_algo

Typestring

The cipher method used for decryption of $data.

$iv

OptionalType?stringDefault valuenull

The initialization vector used for decryption of $data. It is required if the cipher method requires IV. This can be found out by calling openssl_cipher_iv_length with $cipher_algo.

Note that the parameter $output is passed by reference, and contains additional/updated context data that may be useful.

Return value

Typebool

Returns true on success, false on failure

Changes to the openssl_open Function

PHP 8.2

PHP 8.0

  • Return type added: bool
  • Parameter type added for parameter #1 ($data): string
  • Parameter name of parameter #2 changed: $opendata to $output
  • Parameter name of parameter #3 changed: $ekey to $encrypted_key
  • Parameter type added for parameter #3 ($encrypted_key): string
  • Parameter name of parameter #4 changed: $privkey to $private_key
  • Parameter name of parameter #5 changed: $method to $cipher_algo
  • Parameter type added for parameter #5 ($cipher_algo): string
  • Parameter type added for parameter #6 ($iv): ?string
  • Parameter default value added for position #6 ($iv): null
  openssl_open(
-     $data,
+     string $data,
-     &$opendata,
+     &$output,
-     $ekey,
+     string $encrypted_key,
-     $privkey,
+     $private_key,
-     $method,
+     string $cipher_algo,
-     $iv
+     ?string $iv = null
-   )
+   ): bool

PHP 7.0

  • Optional parameter added - #5: $method
  • Optional parameter added - #6: $iv
 openssl_open(
     $data,
     &$opendata,
     $ekey,
-    $privkey
+    $privkey,
+    $method,
+    $iv
   )

openssl_open 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