function aes_enable in AES encryption 7
Same name and namespace in other branches
- 5 aes.module \aes_enable()
- 6 aes.module \aes_enable()
Implements hook_enable().
File
- ./
aes.install, line 63 - Install/uninstall related functions.
Code
function aes_enable() {
if (variable_get("aes_implementation", FALSE)) {
// Implementation method is already set. We assume everything is already configured.
return;
}
$aes_implementations = aes_get_available_aes_implementations();
if ($aes_implementations['phpseclib']) {
variable_set("aes_implementation", "phpseclib");
$install_msg = t("AES enabled using the phpseclib implementation.");
}
else {
if ($aes_implementations['mcrypt']) {
variable_set("aes_implementation", "mcrypt");
$install_msg = t("AES enabled using the MCrypt implementation.");
}
else {
// This case shouldn't actually be possible since hook_requirements should stop the installation if there's no implementation.
variable_set("aes_implementation", "missing");
$install_msg = t("AES enabled but no AES implementation available. Please enable implementation before use!");
}
}
drupal_set_message($install_msg);
$iv = base64_decode(variable_get("aes_encryption_iv", FALSE));
if (empty($iv)) {
aes_make_iv(TRUE);
}
// This will create a new key if one doesn't exist.
aes_get_key();
}