function hook_aes_config_change in AES encryption 7
hook_aes_config_change() This hook provide ability for developers to reencrypt data in modules when aes configuration changed.
Parameters
array $decrypt_params: An associative array with decrypt arguments containing the following keys:
- base64encode: bool Whether this encrypted string is base64 encoded or not.
- custom_key: string Use this as the key rather than the stored one for the operation.
- custom_cipher: string Use this cipher rather than the default one. (only with Mcrypt - ignored with phpseclib)
- custom_iv: string Use this initialization vector instead of the default one.
- custom_implementation: string Can be "phpseclib" or "mcrypt". Warning: Does not check if the requested implementation actually exists.
array $encrypt_params: An associative array with encrypt arguments containing the following keys:
- base64encode: bool Whether to return the string base64 encoded (recommended for database insertion).
- custom_key: string Use this as the key rather than the stored one for the operation.
- custom_cipher: string Use this cipher rather than the default one. (only with Mcrypt - ignored with phpseclib)
- custom_iv: string Use this initialization vector instead of the default one.
- custom_implementation: string Can be "phpseclib" or "mcrypt". Warning: Does not check if the requested implementation actually exists.
See also
Related topics
1 function implements hook_aes_config_change()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- aes_aes_config_change in ./
aes.admin.inc - Implements hook_aes_config_change().
1 invocation of hook_aes_config_change()
- aes_config_submit in ./
aes.admin.inc - Submits aes_config form.
File
- ./
aes.api.php, line 201 - Function and hooks provided by the aes API.
Code
function hook_aes_config_change($decrypt_params, $encrypt_params) {
// Get your current crypted data.
$current_crypted_data = variable_get('custom_data_key', FALSE);
// Decrypt your current data to plain text.
$decrypt_params['string'] = $current_crypted_data;
$plain_data = call_user_func_array('aes_decrypt', $decrypt_params);
// Encrypt data with new eas configuration settings.
$encrypt_params['string'] = $plain_data;
$new_crypted_data = call_user_func_array('aes_encrypt', $encrypt_params);
// Save new crypted data to data store.
variable_set("custom_data_key", $new_crypted_data);
}