Function __global->decrypt_data
Definitions
sources/encryption.php
- Decrypt data using asymmetric encryption, and the site's private key (as unlocked by the given passphrase).A fatal error will occur if the passphrase is empty, the key cannot be found, or if decryption fails for whatever reason.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: string
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $data | string | No | No | required parameter | N/A | N/A | Data to be decrypted |
| $passphrase | string | No | No | required parameter | N/A | N/A | Passphrase to unlock the site's private key |
| &$error_msg | ?string | Yes | No | Null | N/A | N/A | Error message returned (null: do not return an error message) (blank: fill in error message if there is one) |
Returns
- Decrypted data
- Type: string
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Decrypt data using asymmetric encryption, and the site's private key (as unlocked by the given passphrase).A fatal error will occur if the passphrase is empty, the key cannot be found, or if decryption fails for whatever reason.
*
* @param string $data Data to be decrypted
* @param string $passphrase Passphrase to unlock the site's private key
* @param ?string $error_msg Error message returned (null: do not return an error message) (blank: fill in error message if there is one)
* @return string Decrypted data
*/
function decrypt_data(string $data, string $passphrase, ?string &$error_msg = null) : string
* Decrypt data using asymmetric encryption, and the site's private key (as unlocked by the given passphrase).A fatal error will occur if the passphrase is empty, the key cannot be found, or if decryption fails for whatever reason.
*
* @param string $data Data to be decrypted
* @param string $passphrase Passphrase to unlock the site's private key
* @param ?string $error_msg Error message returned (null: do not return an error message) (blank: fill in error message if there is one)
* @return string Decrypted data
*/
function decrypt_data(string $data, string $passphrase, ?string &$error_msg = null) : string
