public static function decrypt($keyString, $data)
 {
     $pos = strrpos($data, TPSecurityUtils::DELIM);
     if ($pos > 0) {
         $data = substr($data, 0, $pos);
     }
     $data = TPSecurityUtils::urldesafe($data);
     if (strlen($keyString) > 32) {
         $keyString = substr($keyString, 0, 32);
     }
     if (strlen($keyString) < 32) {
         $keyString = str_pad($keyString, 32, 'X');
     }
     $iv = TPSecurityUtils::genRandomString(16);
     $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
     if (mcrypt_generic_init($cipher, $keyString, $iv) != -1) {
         $cipherText = mdecrypt_generic($cipher, $data);
         mcrypt_generic_deinit($cipher);
         mcrypt_module_close($cipher);
         $endCharVal = ord(substr($cipherText, strlen($cipherText) - 1, 1));
         if ($endCharVal <= 16 && $endCharVal >= 0) {
             $cipherText = substr($cipherText, 0, 0 - $endCharVal);
             //Remove the padding (ascii value == ammount of padding)
         }
         return $cipherText;
     }
 }