function bakery_decrypt in Bakery Single Sign-On System 7.2
Same name and namespace in other branches
- 6.2 bakery.module \bakery_decrypt()
Decryption handler.
Parameters
string $text: The data to be decrypted.
Return value
string Decrypted text.
1 call to bakery_decrypt()
- bakery_validate_data in ./
bakery.module - Validate signature and decrypt data.
File
- ./
bakery.module, line 1672 - Module file for the Bakery.
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;
}