Example #1
0
        /// <summary>解析字符串的方法
        /// 解密的方法 根据网站间传递的加密串进行解密
        /// </summary>
        ///*编写人:mxk  日期:2011-08-13*/
        /// <param name="decodeStr">需要解密的字符串</param>
        /// <returns>成功返回true 验证失败返回false</returns>
        public static bool DscDecodeString(string decodeStr)
        {
            bool   _isbool    = true;
            string _decodeStr = EncryptionFunc.Decrypt(decodeStr, "bbddZKA*");

            string[] _deAry = _decodeStr.Split('#');
            if (_deAry.Length == 3)
            {
                string[] _splitAry = _deAry[1].Split('@');
                if (_splitAry.Length == 2)
                {
                    if ((DateTime.Now.Minute * 60 + DateTime.Now.Second) - int.Parse(_splitAry[1]) < 60)
                    {
                        _isbool = true;
                    }
                    else
                    {
                        _isbool = false;
                    }
                }
                else
                {
                    _isbool = false;
                }
            }
            else
            {
                _isbool = false;
            }
            return(_isbool);
        }
Example #2
0
        /// <summary>加密字符串的方法
        /// 得到加密字符串的方法 此方法 用于夸网站时候传递的验证串
        /// </summary>
        /// /*编写人:mxk  日期:2011-08-13*/
        /// <returns>返回加密后的字符串</returns>
        public static string AscEncodeString()
        {
            StringBuilder sb = new StringBuilder("@" + Guid.NewGuid().ToString() + "#");

            sb.Append("ZwwyLlZmzW@");
            sb.Append((DateTime.Now.Minute * 60 + DateTime.Now.Second).ToString() + "#");
            sb.Append(DateTime.Now.ToString("yyyyMMdd") + "@");
            return(EncryptionFunc.Encrypt(sb.ToString(), "bbddZKA*"));
        }
Example #3
0
        public LoginTokenID(string value)
        {
            //int test = UniqueObjectID.GetTimestampFromDateTime(DateTime.UtcNow);
            //DateTime saddas = BsonConstants.UnixEpoch.AddSeconds(test);
            if (value == null)
            {
                return;
            }

            try
            {
                value = EncryptionFunc.Decrypt(value, token_ekey);
            }
            catch (Exception)
            {
                return;
            }
            string[] _stemp = value.Split(new string[] { "\f" }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                if (_stemp.Length == 4)
                {
                    _uid            = int.Parse(_stemp[0]);
                    _pwd            = _stemp[1];
                    _uniqueObjectID = new UniqueObjectID(_stemp[2]);
                    _timestamp      = Convert.ToInt32(_stemp[3]);
                }
                else if (_stemp.Length == 3)
                {
                    _uid            = int.Parse(_stemp[0]);
                    _pwd            = _stemp[1];
                    _uniqueObjectID = new UniqueObjectID(_stemp[2]);
                    _timestamp      = UniqueObjectID.GetTimestampFromDateTime(DateTime.UtcNow);
                }
            }
            catch (Exception)
            {
                return;
            }
            if (_uniqueObjectID == null)
            {
                return;
            }
            _machine   = _uniqueObjectID.Machine;
            _pid       = _uniqueObjectID.Pid;
            _increment = _uniqueObjectID.Increment;
        }
Example #4
0
 public override string ToString()
 {
     return(EncryptionFunc.Encrypt(Uid + "\f" + Pwd + "\f" + _uniqueObjectID.ToString() + "\f" + _timestamp, token_ekey));
 }