function encrypt_get_file_key in Encrypt 7.3
Same name and namespace in other branches
- 7.2 plugins/key_providers/file.inc \encrypt_get_file_key()
Callback method to return the encryption key from a file.
1 string reference to 'encrypt_get_file_key'
- encrypt_file_encrypt_key_providers in plugins/
key_providers/ file.inc - Implements MODULE_FILENAME_encrypt_key_providers().
File
- plugins/
key_providers/ file.inc, line 29 - Plugin definition for the File key provider.
Code
function encrypt_get_file_key($settings) {
$file_name = $settings['path'] . '/' . ENCRYPT_FILE_NAME;
// If the file doesn't exist, just abort.
if (!file_exists($file_name)) {
drupal_set_message(t('The file %file does not exist! Encrypt cannot retrieve encryption key.', array(
'%file' => $file_name,
)), 'error');
return;
}
switch ($settings['method']) {
case 'file_contents':
return file_get_contents($file_name);
case 'md5':
return md5_file($file_name);
}
}