openssl_sign
Function • Params changed in PHP 8.5
Generate signature.
openssl_sign Function synopsis
openssl_sign(
string $data,
&$signature,
$private_key,
string|int $algorithm = OPENSSL_ALGO_SHA1,
int $padding = 0
): bool
Parameters
$data
Typestring
The string of data you wish to sign
$signature
Passed by reference
If the call was successful the signature is returned in
$signature.
$private_key
OpenSSLAsymmetricKey - a key, returned by openssl_get_privatekey
$algorithm
OptionalTypestring|intDefault valueOPENSSL_ALGO_SHA1
int - one of these Signature Algorithms.
$padding
OptionalTypeintDefault value0
Note that the parameter
$signatureis 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_sign Function
PHP 8.5
- Optional parameter added - #5:
int $padding = 0
openssl_sign(
string $data,
&$signature,
$private_key,
- string|int $algorithm = OPENSSL_ALGO_SHA1
+ string|int $algorithm = OPENSSL_ALGO_SHA1,
+ int $padding = 0
): bool PHP 8.2
- Attribute added for parameter
$private_key:#[SensitiveParameter]
PHP 8.0
- Return type added:
bool - Parameter type added for parameter #1 (
$data):string - Parameter name of parameter #3 changed:
$keyto$private_key - Parameter name of parameter #4 changed:
$methodto$algorithm - Parameter type added for parameter #4 (
$algorithm):string|int - Parameter default value added for position #4 (
$algorithm):OPENSSL_ALGO_SHA1
openssl_sign(
- $data,
+ string $data,
&$signature,
- $key,
+ $private_key,
- $method
+ string|int $algorithm = OPENSSL_ALGO_SHA1
- )
+ ): bool openssl_sign Function Availability
openssl_sign Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes |
| PHP 8.5Upcoming Release | Yes |
| PHP 8.4Supported (Latest) | Yes |
| PHP 8.3Supported | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Security-Fixes Only | 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 |