/// <summary> /// 生成新的token /// </summary> /// <returns></returns> public static string NewToken() { var user = new { Id = "1", Name = "mirror", // 2小时过期 Expire = DateTimeOffset.Now.AddHours(2).UtcTicks }; // userjson string userjson = SerializeHelp.ObjectToJSON(user); // userjson + aeskey = aes string userAes = SecurityHelp.AESEncrypt(userjson, aesKey16); // sign sha256 len=64 string userSha256 = SecurityHelp.StringSHA256(userjson + aesKey16); // token string token = userAes + userSha256; return(token); }