public int GetDecodedUserAvatar(string code, string encodeKey) { try { var content = DesUtility.DecryptDES(code, encodeKey); var datas = content.Split('|'); var dateTime = new DateTime(long.Parse(datas[0])); if ((DateTime.Now - dateTime).TotalSeconds > 15) { return(-1);//指定秒后失效 } var accountId = int.Parse(datas[1]); return(accountId); } catch { return(-1); } }
public string GetDecodedContent(string content, string encodeKey) { return(DesUtility.DecryptDES(content, encodeKey)); }
/// <summary> /// 通用解密 /// </summary> /// <param name="str"></param> /// <returns></returns> public string CommonDecrypt(string str) { var content = DesUtility.DecryptDES(str, BASE_ENCRYPT_ENCODING_KEY); return(content.Split('|')[0]); }