Exemplo n.º 1
0
        //读取职业技能被单击
        private void button3_Click(object sender, EventArgs e)
        {
            uint   i = 0x4300, 技能地址;
            string 技能名称 = "";
            int    技能等级;
            string 总技能 = "";

            ListView_Skill.Items.Clear();
            while (i <= 0x5000)
            {
                技能地址 = (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 基址.人物基址) + i);
                技能等级 = EncDec.Decrypt(全局变量.进程ID, 技能地址 + 基址.技能等级偏移, 基址.解密基址);
                if (技能等级 >= 0 && 技能等级 < 100)
                {
                    技能名称 = TransCtr.UnicodeToAnsi(ReadWriteCtr.ReadMemByteArray(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 技能地址 + 基址.技能名称偏移), 50));
                    if (技能名称.Length > 1 && 技能名称.IndexOf("?") == -1 && 技能名称.IndexOf("不使用") == -1 && 总技能.IndexOf(技能名称) == -1 && 技能等级 > 0)
                    {
                        this.ListView_Skill.Update();
                        ListViewItem lvi = this.ListView_Skill.Items.Add(Convert.ToString(i));
                        lvi.SubItems.Add(技能名称);
                        lvi.SubItems.Add(Convert.ToString(技能等级));
                        this.ListView_Skill.EndUpdate();
                        总技能 += 技能名称;
                    }
                }
                i += 4;
            }
        }
Exemplo n.º 2
0
        private void 修改属性()
        {
            //声明变量
            int  index = -1, index2, t_level, i = 0;
            uint t_add, t_pet, t_skilladd = 0;

            //ListView_SkillProperties_Edit中有项目才进行修改
            if (this.ListView_SkillProperties_Edit.Items.Count > 0)
            {
                //循环项目数次
                for (i = 0; i < this.ListView_SkillProperties_Edit.Items.Count; i++)
                {
                    index      = -1;
                    index2     = 0;
                    index2     = this.ListView_SkillProperties_Edit.Items[i].SubItems[0].Text.IndexOf("+", index + 1);                                    //公式第一个+号位置
                    t_pet      = Convert.ToUInt32(this.ListView_SkillProperties_Edit.Items[i].SubItems[0].Text.Substring(index + 1, index2 - index - 1)); //技能偏移
                    t_skilladd = (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 基址.人物基址) + t_pet);                     //技能地址
                    t_level    = EncDec.Decrypt(全局变量.进程ID, (uint)t_skilladd + 基址.技能等级偏移, 基址.解密基址);                                                        //技能等级
                    Thread.Sleep(30);                                                                                                                     //延迟30毫秒
                    t_add = (uint)ReadWriteCtr.ReadMemCode(全局变量.进程ID, Convert.ToString(基址.人物基址) + "+" + this.ListView_SkillProperties_Edit.Items[i].SubItems[0].Text);
                    //加密
                    EncDec.Encryption(全局变量.进程ID, (uint)(t_add + 8 * (t_level - 1)), TransCtr.IntToFloat(this.ListView_SkillProperties_Edit.Items[i].SubItems[1].Text), 基址.解密基址);
                    Thread.Sleep(30);   //延迟30毫秒进入下一循环
                }
            }
            else
            {
                MessageBox.Show("List中没有数据", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 3
0
        public override void OnActionExecuting(HttpActionContext actionContext)
        {
            HttpContext context = HttpContext.Current;

            var authorizationAttributes = actionContext.ActionDescriptor.GetCustomAttributes <AllowAnonymousAttribute>();

            if (authorizationAttributes.Count() > 0)
            {
                base.OnActionExecuting(actionContext);
                return;
            }


            try
            {
                var strAuthorization     = actionContext.Request.Headers.GetValues("Authorization").FirstOrDefault();
                var strJsonSecurityToken = EncDec.Decrypt(strAuthorization.Substring(7));

                PayloadDto oPayloadDto = null;
                oPayloadDto = new JavaScriptSerializer().Deserialize <PayloadDto>(strJsonSecurityToken);
                DateTime dteExpireDate = new DateTime(oPayloadDto.expireDate);
                if (dteExpireDate <= DateTime.Now)
                {
                    throw new Exception();
                }

                Setting.payloadDto = oPayloadDto;
            }

            catch (Exception ex)
            {
                actionContext.Response = new System.Net.Http.HttpResponseMessage(System.Net.HttpStatusCode.Unauthorized);
            }
        }
Exemplo n.º 4
0
        public string DecodeString(MemoryStream Lock, string Data)
        {
            Lock.Position = 0;
            var key = DecodeLock(Lock);

            return(EncDec.Decrypt(Data, key));
        }
Exemplo n.º 5
0
        public ActionResult EmailSystem(EmailSystem model)
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            //duong dan file encryption key
            FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkey.config"));
            //lay key da ma hoa
            string    strKeyEncrypt = EncDec.Decrypt(function.ReadXMLGetKeyEncrypt());
            XDocument doc           = new XDocument(
                new XDeclaration("1.0", "utf-8", "true"),
                new XProcessingInstruction("test", "value"),
                new XComment(String.Format("Ngày {0}   author: {1}", DateTime.Now, Session["userid"])),

                new XElement("email",
                             new XElement("smtp_host", model.host),
                             new XElement("smtp_port", model.port),
                             new XElement("smtp_user", AES.EncryptText(model.user, strKeyEncrypt)),
                             new XElement("smtp_pass", AES.EncryptText(model.pass, strKeyEncrypt)),
                             new XElement("displayName", model.displayName),
                             new XElement("enableSSL", model.enableSSL))
                );

            doc.Save(Functions.MapPath("~/Xml/Config/email.xml"));
            return(View());
        }
Exemplo n.º 6
0
        public ActionResult EmailSystem()
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            //duong dan file encryption key
            FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkey.config"));
            //lay key da ma hoa
            string strKeyEncrypt = EncDec.Decrypt(function.ReadXMLGetKeyEncrypt());

            EmailSystem model = new Models.EmailSystem();

            #region doc thong tin chung (chuc vu, nguoi ky, )
            XElement doc  = XElement.Load(Functions.MapPath("~/Xml/Config/email.xml"));
            var      list = doc.Elements();
            model.host        = list.ElementAt(0).Value;
            model.port        = list.ElementAt(1).Value;
            model.user        = AES.DecryptText(list.ElementAt(2).Value, strKeyEncrypt);
            model.pass        = AES.DecryptText(list.ElementAt(3).Value, strKeyEncrypt);
            model.displayName = list.ElementAt(4).Value;
            if (list.ElementAt(5).Value == "1")
            {
                model.enableSSL = true;
            }
            else
            {
                model.enableSSL = false;
            }
            #endregion
            return(View(model));
        }
Exemplo n.º 7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            clsUserLoginManage objUserLogin = new clsUserLoginManage();
            dtoUser            objUser      = new dtoUser();
            string             UserName     = EncDec.Encrypt(txtuserid.Text, DbConnect.AdminKey);
            string             Password     = EncDec.Encrypt(txtpassword.Text, DbConnect.AdminKey);

            DataTable dt = objUserLogin.GetLogin(UserName, Password);

            if (dt.Rows.Count > 0)
            {
                objUser.AUTO_ID      = dt.Rows[0]["AUTO_ID"].ToString();
                objUser.USER_ID      = EncDec.Decrypt(dt.Rows[0]["USER_ID"].ToString(), DbConnect.AdminKey);
                objUser.USER_TYPE    = Convert.ToInt32(dt.Rows[0]["USER_TYPE"].ToString());
                Session["AdminUser"] = objUser;

                if (Session["AdminUser"] != null)
                {
                    Response.Redirect("Home.aspx");
                }
            }
            else
            {
                Session["AdminUser"] = null;
            }
        }
        catch (Exception ex)
        {
            Page.RegisterStartupScript("aa", "<script>alert('" + ex.Message + "');</script>");
        }
    }
Exemplo n.º 8
0
        public static void 技能无CD()
        {
            uint   i = 0x4300, 技能地址;
            string 技能名称 = "";
            int    技能等级;
            string 总技能 = "";

            while (i <= 0x5000)
            {
                技能地址 = (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 基址.人物基址) + i);
                技能等级 = EncDec.Decrypt(全局变量.进程ID, 技能地址 + 基址.技能等级偏移, 基址.解密基址);
                if (技能等级 >= 0 && 技能等级 < 100)
                {
                    技能名称 = TransCtr.UnicodeToAnsi(ReadWriteCtr.ReadMemByteArray(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 技能地址 + 基址.技能名称偏移), 50));
                    if (技能名称.Length > 1 && 技能名称.IndexOf("?") == -1 && 技能名称.IndexOf("不使用") == -1 && 总技能.IndexOf(技能名称) == -1 && 技能等级 > 0)
                    {
                        EncDec.超级加密((int)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址 + 基址.技能冷却1偏移) + 8 * (uint)(技能等级 - 1)), 1000);
                        EncDec.超级加密((int)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址 + 基址.技能冷却2偏移) + 8 * (uint)(技能等级 - 1)), 1000);
                        EncDec.超级加密((int)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址 + 基址.技能冷却3偏移) + 8 * (uint)(技能等级 - 1)), 1000);
                        EncDec.超级加密((int)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址 + 基址.技能冷却4偏移) + 8 * (uint)(技能等级 - 1)), 1000);
                        EncDec.超级加密((int)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址 + 基址.技能冷却5偏移) + 8 * (uint)(技能等级 - 1)), 1000);
                    }
                }
                i += 4;
            }
        }
        /// <summary>
        /// Imports the content of a connections file and adds them to the current collection
        /// </summary>
        public void Import(ImportExportData data)
        {
            try
            {
                string content = null;
                if (data.Encrypt)
                {
                    content = EncDec.Decrypt(data.FileName, true);
                }
                else
                {
                    content = File.ReadAllText(data.FileName);
                }
                SqlConnectionInfosCollection imported = SqlConnectionInfosCollection.Deserialize(content, false);
                if (imported.Count > 0)
                {
                    foreach (SqlConnectionInfo item in imported)
                    {
                        SqlConnections.Add(item);
                    }
                }

                IsChanged = true;
            }
            catch (Exception ex)
            {
                EventLogger.SendMsg(ex);
                throw;
            }
        }
Exemplo n.º 10
0
        public static string decode_passwd(string user, string encoded)
        {
            if (!encoded.StartsWith("{enc}"))
            {
                return(encoded);
            }
            string str = encoded.Substring(5, 8);

            return(EncDec.Decrypt(encoded.Substring(13), str + UserDb.dbkey));
        }
Exemplo n.º 11
0
        string DecryptWithStack(List <BaseLock> Stack, string Value)
        {
            var result = Value;

            for (int i = Stack.Count - 1; i >= 0; i--)
            {
                var s = Stack[i];
                result = EncDec.Decrypt(result, s.GetKey());
            }
            return(result);
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string key        = "K7MCfw+AFMN1HEKmhATQzK2HT5eiFymimN9eu+Yb95s=";
            string strMessage = Request["responseParameter"];

            EncDec aesEncrypt = new EncDec();

            responseparams1 = EncDec.Decrypt(key, strMessage);

            Response.Write(responseparams1);
        }
Exemplo n.º 13
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            qApi.fieldExistenceIndicatorTransaction.FirstOrDefault(k => k.Key == "ReferenceID").Value         = txtReferenceNUmber.Text;
            qApi.fieldExistenceIndicatorTransaction.FirstOrDefault(k => k.Key == "merchantOrderNumber").Value = txtOrderNUmber.Text;
            qApi.fieldExistenceIndicatorTransaction.FirstOrDefault(k => k.Key == "transactionType").Value     = txtTransactionType.Text;

            string encryptedMsg = qApi.GetOrderStatus(new EncDec().Encrypt(qApi.merchantKey, qApi.Calculate()));
            string decryptedMsg = EncDec.Decrypt(qApi.merchantKey, encryptedMsg);

            txtResult.Text = decryptedMsg;
            Calculate(decryptedMsg);
        }
        /// <summary>
        /// Loads the encrypted data.
        /// </summary>
        /// <param name="encryptedData">The encrypted data.</param>
        public void LoadEncryptedData(string encryptedData)
        {
            string jsonData = EncDec.Decrypt(encryptedData);

            SqlConnections = null;
            SqlConnections = SqlConnectionInfosCollection.Deserialize(jsonData, false);
            if (this.SqlConnections == null)
            {
                this.SqlConnections = new SqlConnectionInfosCollection();
            }
            this.IsInEditMode = false;
            this.IsChanged    = false;
        }
Exemplo n.º 15
0
        public ActionResult Invoice(string id)
        {
            ConsignmentService objService = new ConsignmentService();
            ConsignmentModel   objModel   = new ConsignmentModel();
            EncDec             objEnDec   = new EncDec();
            int cid = Convert.ToInt32(objEnDec.Decrypt(id));

            objModel = objService.getGRbyID(cid);

            //List<ChallanModel> lstChallan = new List<ChallanModel>();
            //lstChallan = objService.getChallanTran(id);
            //objModel.ListChallan = new List<ChallanModel>();
            //objModel.ListChallan.AddRange(lstChallan);
            return(View(objModel));
        }
Exemplo n.º 16
0
        public ActionResult PrintChallan(string id)
        {
            ChallanService      objService = new ChallanService();
            ChallanModel        objModel   = new ChallanModel();
            List <ChallanModel> lstChallan = new List <ChallanModel>();
            EncDec objEnDec = new EncDec();
            string cid      = objEnDec.Decrypt(id);

            objModel = objService.GetById(Convert.ToInt32(cid));

            lstChallan = objService.getChallanTran(Convert.ToInt32(cid));
            objModel.ListChallanTran = new List <ChallanModel>();
            objModel.ListChallanTran.AddRange(lstChallan);
            return(View(objModel));
        }
Exemplo n.º 17
0
 public static string ReadValue(string cookieName, string propertyName, bool decrypt)
 {
     if (CookieUtil.CookieExists(cookieName))
     {
         JObject _cookie;
         if (decrypt)
         {
             string val = EncDec.Decrypt(CookieUtil.ReadCookie(cookieName), DefaultPassword);
             _cookie = JObject.Parse(val);
             JToken tok = _cookie[propertyName];
             return((tok == null) || (tok.Type == JTokenType.Null) || (tok.Type == JTokenType.Undefined) || (tok.Type == JTokenType.None) ? null : _cookie[propertyName].ToString().Trim('"'));
         }
         return(ReadValue(cookieName, propertyName));
     }
     return(null);
 }
Exemplo n.º 18
0
        /// <summary> Common constructor logic </summary>
        private Client()
        {
            this.id = Guid.NewGuid();
            tcpReadState.Initialize();
            udpReadState.Initialize();

            tcpOutgoing = new ConcurrentQueue <string>();
            udpOutgoing = new ConcurrentQueue <string>();

            {             // Temp encryption
                EncDec encryptor = new EncDec();
                Crypt  e         = (b) => encryptor.Encrypt(b);
                Crypt  d         = (b) => encryptor.Decrypt(b);
                SetEncDec(e, d);
                //enc = e;
                //dec = d;
            }
        }
        /// <summary>
        /// Loads the encrypted file into the collection.
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <exception cref="NoConnectionDataFileException"></exception>
        private void LoadEncrypted(string fileName)
        {
            if (!fileName.XDwIsNullOrTrimEmpty())
            {
                string jSonData = EncDec.Decrypt(fileName, true);

                this.SqlConnections = null;
                this.SqlConnections = SqlConnectionInfosCollection.Deserialize(jSonData, false);
                if (this.SqlConnections == null)
                {
                    this.SqlConnections = new SqlConnectionInfosCollection();
                }
                this.IsInEditMode = false;
                this.IsChanged    = false;
            }
            else
            {
                throw new NoConnectionDataFileException(SqlConnectionInfoModelRx.excSCIMNoFileToLoad);
            }
        }
Exemplo n.º 20
0
        private static void Main(string[] args)
        {
            EncDec.Encrypt("Build_Test.exe", "Build_Test.exe.dec", "test");

            EncDec.Decrypt("Build_Test.exe.dec", "Build_Test.dec.exe", "test");


            Console.Read();
            Environment.Exit(-1);
            string original = System.Text.Encoding.Unicode.GetString(File.ReadAllBytes("Build_Test.exe"));

            // Create a new instance of the Aes
            // class.  This generates a new key and initialization
            // vector (IV).
            using (Aes myAes = Aes.Create())
            {
                // Encrypt the string to an array of bytes.
                byte[] encrypted = Aes_Example.AesExample.EncryptStringToBytes_Aes(original, myAes.Key, myAes.IV);

                // Decrypt the bytes to a string.
                string roundtrip = Aes_Example.AesExample.DecryptStringFromBytes_Aes(encrypted, myAes.Key, myAes.IV);

                File.WriteAllBytes("Build_Test.exe.dec", encrypted);

                var dec = File.ReadAllBytes("Build_Test.exe.dec");

                string final = Aes_Example.AesExample.DecryptStringFromBytes_Aes(dec, myAes.Key, myAes.IV);

                File.WriteAllBytes("Build_Test.dec.exe", Encoding.Unicode.GetBytes(original));
                //Display the original data and the decrypted data.
                Console.WriteLine("Original:   {0}\n\n", original);
                Console.WriteLine("Round Trip: {0}", final);
            }



            //
            //Aes_Example.AesExample.start();
            Console.Read();
        }
Exemplo n.º 21
0
        private string EncryptData(string connectionString)
        {
            try
            {
                //duong dan file encryption key
                FunctionXML function = new FunctionXML(Functions.MapPath("~/Xml/Config/encryptionkey.config"));
                //lay key da ma hoa
                string strKeyEncrypt = EncDec.Decrypt(function.ReadXMLGetKeyEncrypt());
                //lay gia tri trong cau connection string
                string[] strSplit = connectionString.Split(';');
                //string strServer = AES.DecryptText(strSplit[0].Replace("server=", ""), strKeyEncrypt);
                //string strDatabaseName = AES.DecryptText(strSplit[1].Replace("database=", ""), strKeyEncrypt);
                //string strUserName = AES.DecryptText(strSplit[2].Replace("user id=", ""), strKeyEncrypt);
                //string strPassword = AES.DecryptText(strSplit[3].Replace("password="******""), strKeyEncrypt);

                string strServer       = strSplit[0].Replace("server=", "");
                string strDatabaseName = strSplit[1].Replace("database=", "");
                string strUserName     = strSplit[2].Replace("userid=", "");
                string strPassword     = strSplit[3].Replace("password="******"");


                string aaaa = string.Format("{0};{1};{2};{3}", strServer, strDatabaseName, strUserName, strPassword, strSplit[2].Split('=')[1]);


                //Data Source=RI-TONGHOP-01\SQLEXPRESS;Initial Catalog=RICONS;Integrated Security=True

                return(string.Format("{0};{1};{2};{3}", strServer, strDatabaseName, strUserName, strPassword, strSplit[2].Split('=')[1]));

                //return string.Format("server={0};database={1};user id={2};password={3};Port={4};", strServer, strDatabaseName, strUserName, strPassword, strSplit[4].Split('=')[1]);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
            }
            return(string.Empty);
        }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Initialize();
            bmp = (BitMapModel)Session["bmpObj"];
            string key        = bmp.merchantKey;
            string strMessage = Request["responseParameter"];
            string path       = Server.MapPath("~/log/responseLog.txt");

            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(path, true))
            {
                writer.WriteLine(strMessage);
                writer.Close();
            }

            responseparams1 = EncDec.Decrypt(key, strMessage.Substring(strMessage.IndexOf("||", 0) + 2));
            Table table = new Table();

            dataWithoutMerchantID          = responseparams1;
            blockExistanceField            = dataWithoutMerchantID.Substring(0, dataWithoutMerchantID.IndexOf("||", 0));
            dataWithoutBlockExistenceField = dataWithoutMerchantID.Substring(dataWithoutMerchantID.IndexOf("||", 0) + 2);
            splittedDataBlock = dataWithoutBlockExistenceField.Split(new[] { "||" }, StringSplitOptions.None);
            char[] charArr = blockExistanceField.ToCharArray();
            for (int i = 0, j = 0; i < charArr.Length; i++)
            {
                switch (i)
                {
                case 0:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], paymentKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 1:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], cardKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 2:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], statusKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 3:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], merchantKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 4:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], fraudKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 5:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], dccKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;

                case 6:
                {
                    if (charArr[i] == '1')
                    {
                        DecodeFields(splittedDataBlock[j], tokenKeys);
                        j++;
                    }
                    else
                    {
                        continue;
                    }
                }
                break;
                }
            }
        }
Exemplo n.º 23
0
        public LogIn(string globalAdresar, bool loadingStart)
        {
            _globalAdresar = globalAdresar;
            InitializeComponent();

            if (File.Exists(_globalAdresar + @"AniSubLogIn.jpg"))
            {
                BackgroundImage = Image.FromFile(_globalAdresar + @"AniSubLogIn.jpg");
            }

            LogIn_Language.SelectedIndex = 0;

            LogIn_LB03.BackColor = Color.Black;
            LogIn_LB03.BackColor = Color.Transparent;
            LogIn_LB03.Update();

            Sql();

            var adresar = new DirectoryInfo(_globalAdresar + @"Accounts");

            DialogResult = DialogResult.Cancel;

            foreach (var adresarSub in adresar.GetDirectories())
            {
                if (adresarSub.Name.Substring(0, 1) != "!")
                {
                    LogIn_Accounts.Items.Add(adresarSub.Name);
                    if (File.Exists(_globalAdresar + @"AniSub-Account.hash") && loadingStart)
                    {
                        if (
                            File.Exists(_globalAdresar + @"Accounts\" + adresarSub.Name + @"\" + adresarSub.Name +
                                        ".dat.enc"))
                        {
                            EncDec.Decrypt(
                                _globalAdresar + @"Accounts\" + adresarSub.Name + @"\" + adresarSub.Name + ".dat.enc",
                                _globalAdresar + @"Accounts\" + adresarSub.Name + @"\" + adresarSub.Name + ".dat",
                                "4651511fac9cbbc80c8417779620b893");
                        }

                        SettingsData =
                            Settings.Settings_Load(_globalAdresar + @"Accounts\" + adresarSub.Name + @"\" +
                                                   adresarSub.Name + ".dat");

                        if (SettingsData != null)
                        {
                            if (SettingsData.LoadAutomaticaly)
                            {
                                var bytePass  = Encoding.ASCII.GetBytes(SettingsData.Pass);
                                var byteLogin = Encoding.ASCII.GetBytes(SettingsData.Name);

                                var md5  = MD5.Create();
                                var sha1 = SHA1.Create();

                                var hashPass  = Convert.ToBase64String(md5.ComputeHash(bytePass));
                                var hashLogin = Convert.ToBase64String(md5.ComputeHash(byteLogin));

                                var byteLp = Encoding.ASCII.GetBytes(hashLogin + hashPass);

                                var HashPass = Convert.ToBase64String(sha1.ComputeHash(byteLp));

                                var cti        = new StreamReader(_globalAdresar + @"AniSub-Account.hash");
                                var hashStream = cti.ReadLine().Replace("\r", "").Replace("\n", "");
                                cti.Close();

                                if (hashStream == HashPass)
                                {
                                    DialogResult = DialogResult.OK;
                                    Close();
                                    break;
                                }
                                SettingsData = null;
                            }
                            else
                            {
                                SettingsData = null;
                            }
                        }
                    }
                }
            }

            if (LogIn_Accounts.Items.Count > 0)
            {
                LogIn_Accounts.SelectedIndex = 0;
            }
        }
Exemplo n.º 24
0
        //Přihlásit
        private void LogIn_LogIn_Click(object sender, EventArgs e)
        {
            if (File.Exists(_globalAdresar + @"Accounts\" + LogIn_User.Text + @"\" + LogIn_User.Text + ".dat.enc"))
            {
                EncDec.Decrypt(_globalAdresar + @"Accounts\" + LogIn_User.Text + @"\" + LogIn_User.Text + ".dat.enc",
                               _globalAdresar + @"Accounts\" + LogIn_User.Text + @"\" + LogIn_User.Text + ".dat",
                               "4651511fac9cbbc80c8417779620b893");
            }

            SettingsData =
                Settings.Settings_Load(_globalAdresar + @"Accounts\" + LogIn_User.Text + @"\" + LogIn_User.Text + ".dat");

            if (SettingsData == null)
            {
                SettingsData      = new SettingsData();
                SettingsData.Pass = LogIn_Password.Text;
                SettingsData.Name = LogIn_User.Text;

                var ml = new object[6];

                ml[0] = "";
                ml[1] = "";
                ml[2] = "";
                ml[3] = "";
                ml[4] = 0;
                ml[5] = false;

                SettingsData.MyList.Add(ml);
            }

            if (SettingsData.Pass == LogIn_Password.Text)
            {
                if (LogIn_CH01.Checked)
                {
                    SettingsData.LoadAutomaticaly = true;
                    SettingsData.Language         = LogIn_Language.SelectedIndex;
                    Settings.Settings_Save(
                        _globalAdresar + @"Accounts\" + SettingsData.Name + @"\" + SettingsData.Name + ".dat",
                        SettingsData);

                    var zapis = new StreamWriter(_globalAdresar + @"AniSub-Account.hash", false);

                    var bytePass  = Encoding.ASCII.GetBytes(SettingsData.Pass);
                    var byteLogin = Encoding.ASCII.GetBytes(SettingsData.Name);

                    var md5  = MD5.Create();
                    var sha1 = SHA1.Create();

                    var hashPass  = Convert.ToBase64String(md5.ComputeHash(bytePass));
                    var hashLogin = Convert.ToBase64String(md5.ComputeHash(byteLogin));

                    var byteLp = Encoding.ASCII.GetBytes(hashLogin + hashPass);

                    var HashPass = Convert.ToBase64String(sha1.ComputeHash(byteLp));

                    zapis.Write(HashPass);
                    zapis.Close();
                    zapis.Dispose();
                }
                else
                {
                    SettingsData.LoadAutomaticaly = false;
                    SettingsData.Language         = LogIn_Language.SelectedIndex;
                    Settings.Settings_Save(
                        _globalAdresar + @"Accounts\" + SettingsData.Name + @"\" + SettingsData.Name + ".dat",
                        SettingsData);

                    if (File.Exists(_globalAdresar + @"AniSub-Account.hash"))
                    {
                        File.Delete(_globalAdresar + @"AniSub-Account.hash");
                    }
                }

                DialogResult = DialogResult.OK;
                Close();
            }
            else
            {
                DialogResult = DialogResult.Retry;
                SettingsData = null;
                MessageBox.Show(Language.MessageBox_LogInI, Language.MessageBox_LogIn);
            }
        }
Exemplo n.º 25
0
        public Client(TcpClient tcpClient, Server server = null)
        {
            if (server == null)
            {
                server = Server.NullInstance;
            }
            this.server = server;
            this.id     = Guid.NewGuid();
            this.tcp    = tcpClient;
            tcpReadState.Initialize();
            udpReadState.Initialize();

            var remoteEndPoint = tcpClient.Client.RemoteEndPoint;
            var localEndpoint  = tcpClient.Client.LocalEndPoint;

            Log.Info($"\\eClient \\y {identity}\\e connected from \\y {localEndpoint} -> {remoteEndPoint}");
            if (remoteEndPoint is IPEndPoint && localEndpoint is IPEndPoint)
            {
                IPEndPoint remoteIpep = remoteEndPoint as IPEndPoint;
                IPEndPoint localIpep  = localEndpoint as IPEndPoint;
                remoteIP   = remoteIpep.Address.ToString();
                remotePort = remoteIpep.Port;
                localIP    = localIpep.Address.ToString();
                localPort  = localIpep.Port;

                int localUdpPort  = localPort + 1;
                int remoteUdpPort = remotePort + 1;
                localUdpHost  = new IPEndPoint(remoteIpep.Address, localUdpPort);
                remoteUdpHost = new IPEndPoint(remoteIpep.Address, remoteUdpPort);

                try {
                    udp = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
                    // Note: May need this if there are disconnections due to ICMP errors.
                    // const int SIO_UDP_CONNRESET = -1744830452;
                    // udp.IOControl((IOControlCode)SIO_UDP_CONNRESET, new byte[] { 0, 0, 0, 0 },  null);
                    if (isMaster)
                    {
                        udp.Bind(localUdpHost);
                    }
                    Log.Info($"{identity} UDP Connected to {localUdpHost} ==> {remoteUdpHost}");
                } catch (Exception e) {
                    Log.Warning($"{identity} Failed to bind UDP. Disabling UDP.", e);
                    udp = null;
                }
            }
            else
            {
                remoteIP   = "????";
                remotePort = -1;
                localIP    = "????";
                localPort  = -1;
                Log.Info($"{identity} UDP Unconnected.");
            }
            tcpStream.ReadTimeout  = DEFAULT_READWRITE_TIMEOUT;
            tcpStream.WriteTimeout = DEFAULT_READWRITE_TIMEOUT;

            tcpOutgoing = new ConcurrentQueue <string>();
            udpOutgoing = new ConcurrentQueue <string>();

            {             // Temp encryption
                EncDec encryptor = new EncDec();
                Crypt  e         = (b) => encryptor.Encrypt(b);
                Crypt  d         = (b) => encryptor.Decrypt(b);
                SetEncDec(e, d);
                //enc = e;
                //dec = d;
            }
        }
Exemplo n.º 26
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int i = drpDwnReversalType.SelectedIndex;

            switch (i)
            {
            case 0:
                break;

            case 1:
            {
                string strMessage = txtReferenceNumber.Text;        // + "|";
                EncDec aesEncrypt = new EncDec();
                strMessage = aesEncrypt.Encrypt(txtKey.Text, strMessage);
                string result = EncDec.Decrypt(txtKey.Text, clientObj.InvokeVoidWS(txtMerchantID.Text, strMessage));
                txtResult.Text = result;
                Decode(result, voidKeys);
                break;
            }

            case 2:
            {
                string strMessage = txtReferenceNumber.Text;        // + "|";
                EncDec aesEncrypt = new EncDec();
                strMessage = aesEncrypt.Encrypt(txtKey.Text, strMessage);
                string decry  = clientObj.InvokeFullAuthReversalWS(txtMerchantID.Text, strMessage);
                string result = EncDec.Decrypt(txtKey.Text, decry);
                txtResult.Text = result;
                Decode(result, fullAuthKeys);
                break;
            }

            case 3:
            {
                string strMessage = txtReferenceNumber.Text;        // + "|"+ txtAmount.Text + "|";
                EncDec aesEncrypt = new EncDec();
                strMessage = aesEncrypt.Encrypt(txtKey.Text, strMessage);
                string result = EncDec.Decrypt(txtKey.Text, clientObj.InvokeCaptureWS(txtMerchantID.Text, strMessage));
                txtResult.Text = result;
                Decode(result, captureKeys);
                break;
            }

            case 4:
            {
                amountRow.Visible = true;
                string strMessage = txtReferenceNumber.Text;        // + "|";
                EncDec aesEncrypt = new EncDec();
                strMessage = aesEncrypt.Encrypt(txtKey.Text, strMessage);
                string amount = aesEncrypt.Encrypt(txtKey.Text, txtAmount.Text);
                string result = EncDec.Decrypt(txtKey.Text, clientObj.InvokePartialCaptureWS(txtMerchantID.Text, strMessage, amount));
                txtResult.Text = result;
                Decode(result, partialCaptureKeys);
                break;
            }

            case 5:
            {
                amountRow.Visible = true;
                string strMessage = txtReferenceNumber.Text;        // + "|";
                EncDec aesEncrypt = new EncDec();
                strMessage = aesEncrypt.Encrypt(txtKey.Text, strMessage);
                string amount = aesEncrypt.Encrypt(txtKey.Text, txtAmount.Text);
                string result = EncDec.Decrypt(txtKey.Text, clientObj.InvokeReversalWS(txtMerchantID.Text, strMessage, amount));
                txtResult.Text = result;
                Decode(result, reversalKeys);
                break;
            }
            }
        }
Exemplo n.º 27
0
        //listview_skill事件被双击
        private void ListView_Skill_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int    技能地址1, 技能等级, 技能CD, 技能数据;
            uint   i1, i2, i3, i4, i5, 技能地址2;
            string 总技能公式 = "", 技能数据2 = "";

            //int 技能等级代码;
            全局变量.技能名 = this.ListView_Skill.SelectedItems[0].SubItems[1].Text;
            技能地址1    = ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, 基址.人物基址) + Convert.ToUInt32(this.ListView_Skill.SelectedItems[0].Text));
            技能等级     = EncDec.Decrypt(全局变量.进程ID, (uint)技能地址1 + 基址.技能等级偏移, 基址.解密基址);
            this.ListView_SkillProperties.Items.Clear(); //清空ListView_SkillProperties内容
            技能CD        = EncDec.Decrypt(全局变量.进程ID, (uint)ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.技能冷却1偏移) + 8 * (uint)(技能等级 - 1), 基址.解密基址) / 1000;
            label1.Text = "当前技能cd为:" + 技能CD + "秒";
            //第一层遍历
            i1 = 0;
            while (i1 < 13)
            {
                技能地址2 = (uint)Math.Abs(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.超级技能偏移)) + i1)) + 20));

                if (总技能公式.IndexOf(Convert.ToString(技能地址2)) == -1 && 技能地址2 > 1000000000)
                {
                    技能数据 = EncDec.Decrypt(全局变量.进程ID, (uint)(技能地址2 + 8 * (技能等级 - 1)), 基址.解密基址);
                    if (技能数据 > 1)
                    {
                        技能数据2 = TransCtr.FloatToInt(技能数据);
                        this.ListView_SkillProperties.Update();
                        ListViewItem lvi = this.ListView_SkillProperties.Items.Add(技能数据2);                                                                                //liseview添加项
                        lvi.SubItems.Add(this.ListView_Skill.SelectedItems[0].SubItems[0].Text + "+" + Convert.ToString(基址.超级技能偏移) + "+" + Convert.ToString(i1) + "+20"); //添加次级项
                        lvi.SubItems.Add(Convert.ToString(技能地址2));
                        this.ListView_SkillProperties.EndUpdate();
                        总技能公式 = 总技能公式 + " " + Convert.ToString(技能地址2);
                    }
                }

                i1 += 4;
            }
            //第二层遍历
            i1 = 0;
            while (i1 < 13)
            {
                i2 = 0;
                while (i2 < 13)
                {
                    技能地址2 = (uint)Math.Abs(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.超级技能偏移)) + i1)) + i2)) + 20));

                    if (总技能公式.IndexOf(Convert.ToString(技能地址2)) == -1 && 技能地址2 > 10000000)
                    {
                        技能数据 = EncDec.Decrypt(全局变量.进程ID, (uint)(技能地址2 + 8 * (技能等级 - 1)), 基址.解密基址);
                        if (技能数据 > 1)
                        {
                            技能数据2 = TransCtr.FloatToInt(技能数据);
                            this.ListView_SkillProperties.Update();
                            ListViewItem lvi = this.ListView_SkillProperties.Items.Add(技能数据2);                                                                                                             //liseview添加项
                            lvi.SubItems.Add(this.ListView_Skill.SelectedItems[0].SubItems[0].Text + "+" + Convert.ToString(基址.超级技能偏移) + "+" + Convert.ToString(i1) + "+" + Convert.ToString(i2) + "+20"); //添加次级项
                            lvi.SubItems.Add(Convert.ToString(技能地址2));
                            this.ListView_SkillProperties.EndUpdate();
                            总技能公式 = 总技能公式 + " " + Convert.ToString(技能地址2);
                        }
                    }
                    i2 += 4;
                }
                i1 += 4;
            }
            //第三层遍历
            i1 = 0;
            while (i1 < 13)
            {
                i2 = 0;
                while (i2 < 13)
                {
                    i3 = 0;
                    while (i3 < 13)
                    {
                        技能地址2 = (uint)Math.Abs(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.超级技能偏移)) + i1)) + i2)) + i3)) + 20));

                        if (总技能公式.IndexOf(Convert.ToString(技能地址2)) == -1 && 技能地址2 > 10000000)
                        {
                            技能数据 = EncDec.Decrypt(全局变量.进程ID, (uint)(技能地址2 + 8 * (技能等级 - 1)), 基址.解密基址);
                            if (技能数据 > 1)
                            {
                                技能数据2 = TransCtr.FloatToInt(技能数据);
                                this.ListView_SkillProperties.Update();
                                ListViewItem lvi = this.ListView_SkillProperties.Items.Add(技能数据2);                                                                                                                                          //liseview添加项
                                lvi.SubItems.Add(this.ListView_Skill.SelectedItems[0].SubItems[0].Text + "+" + Convert.ToString(基址.超级技能偏移) + "+" + Convert.ToString(i1) + "+" + Convert.ToString(i2) + "+" + Convert.ToString(i3) + "+20"); //添加次级项
                                lvi.SubItems.Add(Convert.ToString(技能地址2));
                                this.ListView_SkillProperties.EndUpdate();
                                总技能公式 = 总技能公式 + " " + Convert.ToString(技能地址2);
                            }
                        }
                        i3 += 4;
                    }
                    i2 += 4;
                }
                i1 += 4;
            }
            //第四层遍历
            i1 = 0;
            while (i1 < 13)
            {
                i2 = 0;
                while (i2 < 13)
                {
                    i3 = 0;
                    while (i3 < 13)
                    {
                        i4 = 0;
                        while (i4 < 13)
                        {
                            技能地址2 = (uint)Math.Abs(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.超级技能偏移)) + i1)) + i2)) + i3)) + i4)) + 20));

                            if (总技能公式.IndexOf(Convert.ToString(技能地址2)) == -1 && 技能地址2 > 10000000)
                            {
                                技能数据 = EncDec.Decrypt(全局变量.进程ID, (uint)(技能地址2 + 8 * (技能等级 - 1)), 基址.解密基址);
                                if (技能数据 > 1)
                                {
                                    技能数据2 = TransCtr.FloatToInt(技能数据);
                                    this.ListView_SkillProperties.Update();
                                    ListViewItem lvi = this.ListView_SkillProperties.Items.Add(技能数据2);                                                                                                                                                                       //liseview添加项
                                    lvi.SubItems.Add(this.ListView_Skill.SelectedItems[0].SubItems[0].Text + "+" + Convert.ToString(基址.超级技能偏移) + "+" + Convert.ToString(i1) + "+" + Convert.ToString(i2) + "+" + Convert.ToString(i3) + "+" + Convert.ToString(i4) + "+20"); //添加次级项
                                    lvi.SubItems.Add(Convert.ToString(技能地址2));
                                    this.ListView_SkillProperties.EndUpdate();
                                    总技能公式 = 总技能公式 + " " + Convert.ToString(技能地址2);
                                }
                            }
                            i4 += 4;
                        }
                        i3 += 4;
                    }
                    i2 += 4;
                }
                i1 += 4;
            }
            //第五层遍历
            i1 = 0;
            while (i1 < 13)
            {
                i2 = 0;
                while (i2 < 13)
                {
                    i3 = 0;
                    while (i3 < 13)
                    {
                        i4 = 0;
                        while (i4 < 13)
                        {
                            i5 = 0;
                            while (i5 < 13)
                            {
                                技能地址2 = (uint)Math.Abs(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)(ReadWriteCtr.ReadMemInt(全局变量.进程ID, (uint)技能地址1 + 基址.超级技能偏移)) + i1)) + i2)) + i3)) + i4)) + i5)) + 20));

                                if (总技能公式.IndexOf(Convert.ToString(技能地址2)) == -1 && 技能地址2 > 10000000)
                                {
                                    技能数据 = EncDec.Decrypt(全局变量.进程ID, (uint)(技能地址2 + 8 * (技能等级 - 1)), 基址.解密基址);
                                    if (技能数据 > 1)
                                    {
                                        技能数据2 = TransCtr.FloatToInt(技能数据);
                                        this.ListView_SkillProperties.Update();
                                        ListViewItem lvi = this.ListView_SkillProperties.Items.Add(技能数据2);                                                                                                                                                                                                    //liseview添加项
                                        lvi.SubItems.Add(this.ListView_Skill.SelectedItems[0].SubItems[0].Text + "+" + Convert.ToString(基址.超级技能偏移) + "+" + Convert.ToString(i1) + "+" + Convert.ToString(i2) + "+" + Convert.ToString(i3) + "+" + Convert.ToString(i4) + "+" + Convert.ToString(i5) + "+20"); //添加次级项
                                        lvi.SubItems.Add(Convert.ToString(技能地址2));
                                        this.ListView_SkillProperties.EndUpdate();
                                        总技能公式 = 总技能公式 + " " + Convert.ToString(技能地址2);
                                    }
                                }
                                i5 += 4;
                            }
                            i4 += 4;
                        }
                        i3 += 4;
                    }
                    i2 += 4;
                }
                i1 += 4;
            }
        }
Exemplo n.º 28
0
 public static void __Decrypt()
 {
     EncDec.Decrypt(file, Path.GetDirectoryName(file) + "\\" + Path.GetFileNameWithoutExtension(file), passwd);
     Ende();
 }
Exemplo n.º 29
0
        public string decipherDataS(string login, string password, string dataToDecipher)
        {
            string key = computeAESSkey(login, password);

            EncDec aes = new EncDec();

            string deciphered = aes.Decrypt(dataToDecipher, key);

            return deciphered;
        }
        public static void DoDecrypt(string FileNames, string _entropy)
        {
            if (string.IsNullOrWhiteSpace(_entropy))
            {
                _entropy = EntropyGenerator.GetIPForMachine();
            }

            /*if (_entropy != null)
             * {
             *  _entropy = _entropy + "test this app for exam app";
             * }
             * else
             *  _entropy = EntropyGenerator.GetIPForMachine() + "test this app for exam app";
             *
             * entropy = UnicodeEncoding.ASCII.GetBytes(_entropy.ToCharArray(), 0, 16);
             * IV = UnicodeEncoding.ASCII.GetBytes(Reverse(_entropy).ToCharArray(), 0, 16);
             */

            decryptedData = null;
            // Open the file.
            if (string.IsNullOrWhiteSpace(FileNames))
            {
                FileName = Application.StartupPath + @"\Data.txt";
            }
            else
            {
                FileName = FileNames;
            }

            //if (FileName.EndsWith(".xml"))
            //{
            //    EncDec.Decrypt(FileName, Application.StartupPath + @"\dataToDecrypt.xml", _entropy);
            //    decryptedData = System.IO.File.ReadAllText(Application.StartupPath + @"\dataToDecrypt.xml");
            //}
            //else
            //{
            if (File.Exists(Application.StartupPath + @"\dataToDecrypt.txt"))
            {
                System.IO.File.Delete(Application.StartupPath + @"\dataToDecrypt.txt");
            }

            try
            {
                EncDec.Decrypt(FileName, Application.StartupPath + @"\dataToDecrypt.txt", _entropy);

                decryptedData = System.IO.File.ReadAllText(Application.StartupPath + @"\dataToDecrypt.txt");
                System.IO.File.Delete(Application.StartupPath + @"\dataToDecrypt.txt");
            }
            catch (Exception ex)
            {
                LogEntry.WriteLog(ex, "Thread Exception");
            }
            //}

            /*
             * fStream = new FileStream("Data.dat", FileMode.Open);
             * }
             *
             *
             *
             *
             *
             * Aes aesAlg = Aes.Create();
             *
             * aesAlg.Key = entropy;
             * aesAlg.IV = IV;
             * // aesAlg.Padding = PaddingMode.None;
             * // Create a decrytor to perform the stream transform.
             * ICryptoTransform encryptor = aesAlg.CreateDecryptor(entropy, IV);
             * CryptoStream crStream = new CryptoStream(fStream,
             *    encryptor, CryptoStreamMode.Read);
             *
             * StreamReader reader = new StreamReader(crStream);
             *
             * decryptedData = reader.ReadToEnd();
             *
             * reader.Close();
             * fStream.Close();
             *
             *
             * /*CODE
             * int bytesWritten = Convert.ToInt32(f.Length);
             *
             * byte[] inBuffer = new byte[bytesWritten];
             *
             *
             * // Read the encrypted data from a stream.
             * if (fStream.CanRead)
             * {
             *    fStream.Read(inBuffer, 0, bytesWritten);
             * }
             *
             * /* byte[] buffer = new byte[bytesWritten];
             * using (MemoryStream ms = new MemoryStream())
             * {
             *     int read;
             *     while ((read = fStream.Read(buffer, 0, buffer.Length)) > 0)
             *     {
             *         ms.Write(buffer, 0, read);
             *     }
             *
             *
             *
             * // Decrypt the bytes to a string.
             * string roundtrip = DecryptStringFromBytes_Aes(inBuffer,
             * entropy, IV); */
            //}

            /*if (_entropy != null)
             *  entropy = UnicodeEncoding.ASCII.GetBytes(_entropy);
             * DoDecrypt();*/
        }