openssl_seal
Seal (encrypt) data.
openssl_seal Function synopsis
openssl_seal(
string $data,
&$sealed_data,
&$encrypted_keys,
array $public_key,
string $cipher_algo,
&$iv = null
): int|false
Parameters
$data
Typestring
The data to seal.
$sealed_data
Passed by reference
The sealed data.
$encrypted_keys
Passed by reference
Array of encrypted keys.
$public_key
Typearray
Array of OpenSSLAsymmetricKey instances containing public keys.
$cipher_algo
Typestring
The cipher method.
$iv
Passed by reference, OptionalDefault valuenull
The initialization vector 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 parameters
$sealed_data,$encrypted_keys, and$ivare passed by reference, and contain additional/updated context data that may be useful.
Return value
Typeint|false
Returns the length of the sealed data on success, or false on error.
If successful the sealed data is returned in
$sealed_data, and the envelope keys in
$encrypted_keys.
Changes to the openssl_seal Function
PHP 8.2
- Attribute added for parameter
$data:#[SensitiveParameter]
PHP 8.0
- Return type added:
int|false - Parameter type added for parameter #1 (
$data):string - Parameter name of parameter #2 changed:
$sealdatato$sealed_data - Parameter name of parameter #3 changed:
$ekeysto$encrypted_keys - Parameter name of parameter #4 changed:
$pubkeysto$public_key - Parameter type added for parameter #4 (
$public_key):array - Parameter name of parameter #5 changed:
$methodto$cipher_algo - Parameter type added for parameter #5 (
$cipher_algo):string - Parameter default value added for position #6 (
$iv):null
openssl_seal(
- $data,
+ string $data,
- &$sealdata,
+ &$sealed_data,
- &$ekeys,
+ &$encrypted_keys,
- $pubkeys,
+ array $public_key,
- $method,
+ string $cipher_algo,
- &$iv
+ &$iv = null
- )
+ ): int|false PHP 7.0
- Optional parameter added - #6:
&$iv
openssl_seal(
$data,
&$sealdata,
&$ekeys,
$pubkeys,
- $method
+ $method,
+ &$iv
) PHP 5.6
- Optional parameter added - #5:
$method
openssl_seal(
$data,
&$sealdata,
&$ekeys,
- $pubkeys
+ $pubkeys,
+ $method
) openssl_seal Function Availability
openssl_seal Function Availability| PHP Version | Availability |
|---|---|
| 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 |