public static string Encrypt(string userId) { var data = new UserIdSessionData { UserId = userId, IssueDate = DateTime.Now }; return(Encrypt(data)); }
public static UserIdSessionData Decrypt(string input) { var str = String.Empty; UserIdSessionData data = null; try { str = AESDecrypt(UrlDecode(input)); } catch (Exception) { } if (!String.IsNullOrEmpty(str)) { data = Utils.DeserializeDataContract <UserIdSessionData>(str); } return(data); }
public static string Encrypt(UserIdSessionData data) { return(UrlEncode(AESEncrypt(Utils.DataContractToJson(data)))); }