You are here

function field_encrypt_decrypt in Field Encryption 7

Decrypt encrypted message.

Parameters

string $encrypted: The encrypted data.

Return value

mixed|string The raw message.

4 calls to field_encrypt_decrypt()
FieldEncyptCacheTrait::decrypt in ./field_encrypt.cache.inc
Decrypts the data from the Cache backend.
field_encrypt_un_encrypt in ./field_encrypt.inc
Remove encryption from a field.
field_encrypt_update_7000 in ./field_encrypt.install
Update database schema to re-used existing field tables.
_field_encrypt_field_storage_pre_load in ./field_encrypt.inc
Implements hook_field_storage_pre_load().

File

./field_encrypt.inc, line 320
Encryption functionality for the Field encrypt module.

Code

function field_encrypt_decrypt($encrypted) {
  $encrypted = utf8_decode($encrypted);
  try {
    $decrypted = decrypt($encrypted, array(
      'base64' => TRUE,
    ));
  } catch (Exception $e) {
    return null;
  }
  return $decrypted;
}