private function Bakery::encrypt in Bakery Single Sign-On System 7.3
Encrypt text.
Parameters
string $text Unencrypted base64 encoded text.:
Return value
string Encrypted text.
1 call to Bakery::encrypt()
- Bakery::bakeData in ./
bakery.inc - Serialze, sign and encode data for secure transport.
File
- ./
bakery.inc, line 268
Class
Code
private function encrypt($text) {
$key = $this->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 = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $data;
}