function aes_store_key in AES encryption 6
Same name and namespace in other branches
- 5 aes.module \aes_store_key()
- 7 aes.module \aes_store_key()
2 calls to aes_store_key()
- aes_config_submit in ./
aes.module - aes_get_key in ./
aes.module
File
- ./
aes.module, line 468
Code
function aes_store_key($key) {
$storage_method = variable_get("aes_key_storage_method", "Database");
if ($storage_method == "Database") {
variable_set("aes_key", $key);
}
else {
if ($storage_method == "File") {
$fp = fopen(variable_get("aes_key_path", ""), "w");
if ($fp === false) {
drupal_set_message(t("Couldn't write key to file " . variable_get("aes_key_path", "")), "error");
return false;
}
$key = fwrite($fp, $key);
fclose($fp);
}
else {
drupal_set_message(t("Unknown storage method in AES module."), "error");
return false;
}
}
return true;
}