You are here

function bakery_decrypt in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 7.2 bakery.module \bakery_decrypt()

Decryption handler.

Parameters

$text, The data to be decrypted.:

Return value

Decrypted text.

1 call to bakery_decrypt()
bakery_validate_data in ./bakery.module
Validate signature and decrypt data.

File

./bakery.module, line 1552

Code

function bakery_decrypt($text) {
  $key = variable_get('bakery_key', '');
  $td = mcrypt_module_open('rijndael-128', '', 'ecb', '');
  $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
  $key = substr($key, 0, mcrypt_enc_get_key_size($td));
  mcrypt_generic_init($td, $key, $iv);
  $data = mdecrypt_generic($td, $text);
  mcrypt_generic_deinit($td);
  mcrypt_module_close($td);
  return $data;
}