Ejemplo n.º 1
0
        public static string GetDecryptCookie(string strName)
        {
            try
            {
                string result = GetCookie(strName);
                if (!string.IsNullOrEmpty(result))
                {
                    result = EncryptTools.DESDecrypt(result);
                }

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 给当前请求签名
        /// </summary>
        /// <returns></returns>
        public static string SignRequest(Dictionary <string, string> parameters, string secretkey)
        {
            SortedDictionary <string, string>            dic2 = new SortedDictionary <string, string>(parameters);
            IEnumerator <KeyValuePair <string, string> > dem  = dic2.GetEnumerator();
            StringBuilder sb = new StringBuilder();

            while (dem.MoveNext())
            {
                string key = dem.Current.Key;
                string val = dem.Current.Value;
                if (!string.IsNullOrEmpty(key))
                {
                    sb.Append(key).Append(val);
                }
            }
            sb.Append(secretkey);
            string ms5 = EncryptTools.MD5(sb.ToString());

            return(ms5);
        }
Ejemplo n.º 3
0
        public static void WriteEncryptCookie(string strName, string strValue, int expiresMinutes)
        {
            strValue = EncryptTools.DESEncrypt(strValue);

            WriteCookie(strName, strValue, expiresMinutes);
        }