public void Base64Test() { string plainText = "hello world"; string encrypted = Encryption.Base64Encrypt(plainText); string decrypted = Encryption.Base64Decrypt(encrypted); Assert.NotEqual(plainText, encrypted); Assert.Equal(plainText, decrypted); }
/// <summary> /// 获取一个新的ticket /// </summary> /// <param name="guid">用户的guid</param> /// <param name="client">客户端</param> /// <returns></returns> public static string GenerateTicket(string guid, string client) { //随机key string randomKey = Randoms.GetRandomString(15); var keys = key + randomKey; var desStr = Encryption.DesEncrypt(guid + "&" + client, keys); var base64Str = Encryption.Base64Encrypt(desStr) + randomKey; return(base64Str); }