Ejemplo n.º 1
0
 /**
  * Generate an encrypted tracker string.
  *
  * @param string $tracker_name
  *   The tracker name.
  * @param integer|string $sub_id
  *   The tracker sub id or * if any is permitted.
  * @param $user_id
  *   The user id.
  *
  * @return string
  *   Then encrypted data.
  */
 public static function getTrackerLink($tracker_name, $sub_id = 0, $user_id = -1)
 {
     // Generate a json encoded string with the tracking data.
     $string = json_encode(array('tracker' => self::getTrackerId($tracker_name), 'sub' => $sub_id, 'user' => $user_id > -1 ? $user_id : ClientUser::getInstance()->id));
     // Encrypt the string with the public key.
     return urlencode(Encryption::aesEncrypt($string, Configuration::get('tracker.key')));
 }
Ejemplo n.º 2
0
 /**
  * Get this users encrypted email.
  *
  * @return string
  *   The encrypted email reference.
  */
 public function getEncryptedUserReference()
 {
     return Encryption::aesEncrypt($this->email, Configuration::get('user.key'));
 }
Ejemplo n.º 3
0
 function encrypt($table, $column, $value)
 {
     // TODO: use remote AES encryption method for isolated HSM.
     $table_key = Configuration::get('lightning.table.encryption_key');
     return Encryption::aesEncrypt($value, $table_key);
 }