Exemplo n.º 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);
        }
Exemplo n.º 2
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;
        }