Example #1
0
    public DateTime GetStageBossTime(eStageKind _kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();
        string bossTime = AESSecurity.DecryptStringFromBytes_Aes(UserStageBossTime[(int)_kind], keyIV.Key, keyIV.IV);

        return(Convert.ToDateTime(bossTime));
    }
Example #2
0
    public void ChangeStageBossTime(eStageKind _kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        UserStageBossTime[(int)_kind] = AESSecurity.Encrypt_ToBytes_Aes <string>(
            DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), keyIV.Key, keyIV.IV);
    }
Example #3
0
        public ActionResult ConfirmForgotPassword(string userCode, string usernameCode, string emailCode)
        {
            try
            {
                if (userCode != null && usernameCode != null)
                {
                    string userID   = AESSecurity.DecryptPassword(userCode);
                    string username = AESSecurity.DecryptPassword(usernameCode);
                    //string email = AESSecurity.DecryptPassword(emailCode.Replace("+", " "));

                    var modelObj = Newtonsoft.Json.JsonConvert.SerializeObject(userID);
                    TempData["_ForgotPassword"] = modelObj;

                    return(RedirectToAction("CreateNewPassword", "Privileged"));
                }
            }
            catch (MySqlException MysqlEx)
            {
                ViewBag.MysqlEx = MysqlEx.Message.ToString();
            }
            catch (ArgumentException arEx)
            {
                throw new ArgumentException("Your Exception : " + arEx.Message.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your Exception : " + ex.Message.ToString());
            }

            return(Ok());
        }
Example #4
0
    public void ChangeTutorialstoryClear(eStoryState _state)
    {
        //AESKeyAndIV keyIv = SaveSystem.LoadAESKeyAndIV();

        TutorialStoryClear[(int)_state] =
            AESSecurity.Encrypt_ToBytes_Aes <bool>(true, keyIV.Key, keyIV.IV);
    }
        public void DecyptAndEncrypt()
        {
            var target       = new AESSecurity(this._Configuration);
            var clearTxt     = "HelloWorld";
            var encryptedTxt = target.AesEncrypt(clearTxt);

            Assert.Equal(clearTxt, target.AesDecypt(encryptedTxt));
        }
Example #6
0
    public void UserBuildingLevel_LevelUp(eBuildingKind _Kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        int currentLevel = AESSecurity.DecryptIntFromBytes_Aes(UserBuildingLevel[(int)_Kind], keyIV.Key, keyIV.IV);

        UserBuildingLevel[(int)_Kind] = AESSecurity.Encrypt_ToBytes_Aes <int>(currentLevel + 1, keyIV.Key, keyIV.IV);
    }
Example #7
0
    public void ChangeUserGold(int _inputGold)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        int currentGold = GetUserGold();

        UserGold = AESSecurity.Encrypt_ToBytes_Aes <int>(currentGold + _inputGold, keyIV.Key, keyIV.IV);
        GoodsSceneInstance.Instance.RenewalUI_Gold();
    }
Example #8
0
        public IActionResult ResetPassword(string password)
        {
            try
            {
                if (TempData["_ForgotPassword"] is string userID)
                {
                    var forgotPassword = Newtonsoft.Json.JsonConvert.DeserializeObject(userID).ToString();

                    MySqlConnection conn = new MySqlConnection(Constants.ConnsStrings);
                    MySqlCommand    cmd  = new MySqlCommand();

                    cmd.Connection  = conn;
                    cmd.CommandText = QueryProcedureHelper.SP_CREATE_NEW_PASSWORD;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue(Constants.p_NewPassword, AESSecurity.EncryptPassword(password));
                    cmd.Parameters.AddWithValue(Constants.p_UserID, forgotPassword);
                    conn.Open();

                    cmd.ExecuteNonQuery();
                    if (conn.State == System.Data.ConnectionState.Open)
                    {
                        conn.Close();
                    }

                    return(StatusCode(200));
                }
            }
            catch (MySqlException MysqlEx)
            {
                ViewBag.MysqlEx = MysqlEx.Message.ToString();
            }
            catch (ArgumentException arEx)
            {
                throw new ArgumentException("Your Exception : " + arEx.Message.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your Exception : " + ex.Message.ToString());
            }

            return(Ok());
        }
Example #9
0
        private void SendMailActivationAccount(UserDetails userModel)
        {
            try
            {
                string fullName     = userModel.PreferredName == null ? userModel.FirstName : userModel.PreferredName != null ? userModel.PreferredName : string.Empty;
                string activateCode = AESSecurity.EncryptPassword(userModel.Email);

                MimeMessage emailMessage = new MimeMessage();
                emailMessage.From.Add(new MailboxAddress("*****@*****.**", EmailConstant.EmailAddress));
                emailMessage.To.Add(new MailboxAddress(fullName, userModel.Email));
                emailMessage.Subject = "Acativation Your Account.";

                emailMessage.Body = new TextPart(MimeKit.Text.TextFormat.Html)
                {
                    Text = EmailConstant.AcctivationAccount(fullName, HttpContext.Request.Scheme, HttpContext.Request.Host.Value, userModel.UserID, activateCode)
                };

                using (SmtpClient mailClient = new SmtpClient())
                {
                    mailClient.Connect(EmailConstant.SmtpServer, EmailConstant.SmtpPort, MailKit.Security.SecureSocketOptions.StartTlsWhenAvailable);
                    mailClient.AuthenticationMechanisms.Remove("XOAUTH2");
                    mailClient.Authenticate(EmailConstant.SmtpUsername, EmailConstant.SmtpPassword);
                    mailClient.Send(emailMessage);
                    mailClient.Disconnect(true);
                    mailClient.Dispose();
                }
            }
            catch (MySqlException sqlEx)
            {
                sqlEx.Message.ToString();
            }
            catch (ArgumentException arEx)
            {
                throw new ArgumentException("Your Exception : " + arEx.Message.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your Exception : " + ex.Message.ToString());
            }
        }
Example #10
0
        // POST: Administrator/AddUserRegisterWithoutPrivileged
        public async Task <ActionResult> AddRegisterUser(UserDetails userDetails)
        {
            if (userDetails != null)
            {
                UserDetails result = await MysqlHelper <UserDetails> .ExecuteProcedureSingleAsync(QueryProcedureHelper.SP_ADD_USERS, new
                {
                    p_FirstName     = userDetails.FirstName,
                    P_Lastname      = userDetails.LastName,
                    p_PreferredName = userDetails.PreferredName,
                    p_PhoneNumber   = userDetails.Phone,
                    p_BirthDate     = userDetails.BirthDate,
                    P_Username      = userDetails.UserName,
                    p_Email         = userDetails.Email,
                    p_Password      = AESSecurity.EncryptPassword(userDetails.Password)
                }) as UserDetails;

                if (result.Email != null && result.UserName != null)
                {
                    SendMailActivationAccount(result);
                }
            }

            return(Ok());
        }
Example #11
0
        private void SendMailForgotPassword(string userId, string userName, string email)
        {
            try
            {
                MimeMessage emailMessage = new MimeMessage();
                emailMessage.From.Add(new MailboxAddress("*****@*****.**", EmailConstant.EmailAddress));
                emailMessage.To.Add(new MailboxAddress(userName, email));
                emailMessage.Subject = "Reset Password.";

                emailMessage.Body = new TextPart(MimeKit.Text.TextFormat.Html)
                {
                    Text = EmailConstant.ForgotPassword(userName, HttpContext.Request.Scheme, HttpContext.Request.Host.Value, AESSecurity.EncryptPassword(userId), AESSecurity.EncryptPassword(userName), AESSecurity.EncryptPassword(email))
                };

                using (SmtpClient mailClient = new SmtpClient())
                {
                    mailClient.Connect(EmailConstant.SmtpServer, EmailConstant.SmtpPort, MailKit.Security.SecureSocketOptions.StartTlsWhenAvailable);
                    mailClient.AuthenticationMechanisms.Remove("XOAUTH2");
                    mailClient.Authenticate(EmailConstant.SmtpUsername, EmailConstant.SmtpPassword);
                    mailClient.Send(emailMessage);
                    mailClient.Disconnect(true);
                    mailClient.Dispose();
                }
            }
            catch (MySqlException sqlEx)
            {
                sqlEx.Message.ToString();
            }
            catch (ArgumentException arEx)
            {
                throw new ArgumentException("Your Exception : " + arEx.Message.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("Your Exception : " + ex.Message.ToString());
            }
        }
Example #12
0
    public User()
    {
        using (Aes aesAlg = Aes.Create())
        {
            keyIV = SaveSystem.LoadAESKeyAndIV();

            if (SaveSystem.LoadAESKeyAndIV() != null)
            {
                aesAlg.Key = keyIV.Key;
                aesAlg.IV  = keyIV.IV;
            }
            else if (SaveSystem.LoadAESKeyAndIV() == null)
            {
                keyIV = new AESKeyAndIV(aesAlg.Key, aesAlg.IV);
                SaveSystem.SaveAESKeyAndIV(aesAlg.Key, aesAlg.IV);
            }

            // User Info
            //UserGold = 1000;
            //UserJam = 10;
            //TutorialStoyClear = new bool[(int)eStoryState.END];
            //for (int i = 0; i < (int)eStoryState.END; i++)
            //{
            //    TutorialStoyClear[i] = false;
            //}
            UserGold           = AESSecurity.Encrypt_ToBytes_Aes <int>(1000, aesAlg.Key, aesAlg.IV);
            UserJam            = AESSecurity.Encrypt_ToBytes_Aes <int>(10, aesAlg.Key, aesAlg.IV);
            TutorialStoryClear = new List <byte[]>();
            for (int i = 0; i < (int)eStoryState.END; i++)
            {
                TutorialStoryClear.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(false, aesAlg.Key, aesAlg.IV));
            }

            // Hero Info

            /*
             * UserAbilityLevel = new int[(int)eHeroAbilityKind.END];
             * for (int i = 0; i < (int)eHeroAbilityKind.END; i++)
             * {
             *  UserAbilityLevel[i] = 1;
             * }
             *
             * UserSkillLevel = new int[(int)eHeroAbilityKind.END];
             * for (int i = 0; i < (int)eHeroSkillKind.END; i++)
             * {
             *  UserSkillLevel[i] = 1;
             * }
             *
             * UserBuildingLevel = new int[(int)eHeroAbilityKind.END];
             * for (int i = 0; i < (int)eBuildingKind.END; i++)
             * {
             *  UserBuildingLevel[i] = 1;
             * }
             *
             * UserIsUnlockSkill = new bool[(int)eHeroSkillKind.END];
             * for (int i = 0; i < (int)eHeroSkillKind.END; i++)
             * {
             *  // 임시로 스매시 스킬 언락
             *  if (i == 0)
             *  {
             *      UserIsUnlockSkill[i] = true;
             *  }
             *  else
             *  {
             *      UserIsUnlockSkill[i] = false;
             *  }
             * }
             */
            UserAbilityLevel = new List <byte[]>();
            for (int i = 0; i < (int)eHeroAbilityKind.END; i++)
            {
                UserAbilityLevel.Add(AESSecurity.Encrypt_ToBytes_Aes <int>(1, aesAlg.Key, aesAlg.IV));
            }
            UserSkillLevel = new List <byte[]>();
            for (int i = 0; i < (int)eHeroSkillKind.END; i++)
            {
                UserSkillLevel.Add(AESSecurity.Encrypt_ToBytes_Aes <int>(1, aesAlg.Key, aesAlg.IV));
            }
            UserBuildingLevel = new List <byte[]>();
            for (int i = 0; i < (int)eBuildingKind.END; i++)
            {
                UserBuildingLevel.Add(AESSecurity.Encrypt_ToBytes_Aes <int>(1, aesAlg.Key, aesAlg.IV));
            }
            UserIsUnlockSkill = new List <byte[]>();
            for (int i = 0; i < (int)eHeroSkillKind.END; i++)
            {
                if (i == 0)
                {
                    UserIsUnlockSkill.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(true, aesAlg.Key, aesAlg.IV));
                }
                UserIsUnlockSkill.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(false, aesAlg.Key, aesAlg.IV));
            }

            // Stage Info

            /*
             * UserIsStageOpen = new bool[(int)eStageKind.END];
             * {
             *  for (int i = 0; i < (int)eStageKind.END; i++)
             *  {
             *      if (i == 0)
             *      {
             *          UserIsStageOpen[i] = true;  // Stage1은 처음부터 열려있다.
             *      }
             *      else if (i == 1)
             *      {
             *          UserIsStageOpen[i] = false;  // 임시로 열어둠
             *      }
             *      else
             *      {
             *          UserIsStageOpen[i] = false;
             *      }
             *  }
             * }
             *
             * UserStageBossShow = new bool[(int)eStageKind.END];
             * for (int i = 0; i < (int)eStageKind.END; i++)
             * {
             *  //UserStageBossShow[i] = false;
             *  if (i == 0)
             *  {
             *      UserStageBossShow[i] = false;    // 임의로 열어놓음
             *  }
             *  else
             *  {
             *      UserStageBossShow[i] = false;
             *  }
             * }
             *
             * UserStageBossClear = new bool[(int)eStageKind.END];
             * for (int i = 0; i < (int)eStageKind.END; i++)
             * {
             *  UserStageBossClear[i] = false;
             * }
             *
             * UserStageBossTime = new string[(int)eStageKind.END];
             * for (int i = 0; i < (int)eStageKind.END; i++)
             * {
             *  // 현재 시간 - 1Day 으로 저장
             *  UserStageBossTime[i] = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss");
             * }
             */

            UserIsStageOpen = new List <byte[]>();
            for (int i = 0; i < (int)eStageKind.END; i++)
            {
                if (i == 0)
                {
                    UserIsStageOpen.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(true, aesAlg.Key, aesAlg.IV));
                }
                else
                {
                    UserIsStageOpen.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(false, aesAlg.Key, aesAlg.IV));
                }
            }
            UserStageBossShow = new List <byte[]>();
            for (int i = 0; i < (int)eStageKind.END; i++)
            {
                UserStageBossShow.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(false, aesAlg.Key, aesAlg.IV));
            }
            UserStageBossClear = new List <byte[]>();
            for (int i = 0; i < (int)eStageKind.END; i++)
            {
                UserStageBossClear.Add(AESSecurity.Encrypt_ToBytes_Aes <bool>(false, aesAlg.Key, aesAlg.IV));
            }
            UserStageBossTime = new List <byte[]>();
            for (int i = 0; i < (int)eStageKind.END; i++)
            {
                UserStageBossTime.Add(AESSecurity.Encrypt_ToBytes_Aes <string>(
                                          DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd HH:mm:ss"), aesAlg.Key, aesAlg.IV));
            }

            // Option Info
            BGMVolume = 1.0f;
            BGMMute   = false;
            SFxVolume = 1.0f;
            SFxMute   = false;
        }
    }
Example #13
0
    public void ChangeUserStageBossClear(eStageKind _kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        UserStageBossClear[(int)_kind] = AESSecurity.Encrypt_ToBytes_Aes <bool>(true, keyIV.Key, keyIV.IV);
    }
Example #14
0
        public IActionResult GetUserLogin(string txtPrivilegedInfo, string txtPassword)
        {
            List <UserLoginModel> listUser = new List <UserLoginModel>();
            UserLoginModel        user     = new UserLoginModel();

            try
            {
                MySqlConnection conn = new MySqlConnection(Constants.ConnsStrings);
                MySqlCommand    cmd  = new MySqlCommand();

                string regexEmail      = @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z";
                string regexUsername   = @"@[a-zA-Z0-9]+";
                string replaceText     = string.Empty;
                string passUser        = AESSecurity.EncryptPassword(txtPassword);
                bool   emailIsValid    = Regex.IsMatch(txtPrivilegedInfo, regexEmail, RegexOptions.IgnoreCase);
                bool   usernameIsValid = Regex.IsMatch(txtPrivilegedInfo, regexUsername, RegexOptions.IgnoreCase);

                if (emailIsValid == true)
                {
                    replaceText = txtPrivilegedInfo;

                    cmd.Connection  = conn;
                    cmd.CommandText = QueryProcedureHelper.SP_CHECK_ACCOUNT_LOGIN_VERIFY_EMAIL_ADDRESS;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue(Constants.p_EmailAddress, replaceText);
                    cmd.Parameters.AddWithValue(Constants.p_Password, passUser);
                    conn.Open();
                }
                else if (usernameIsValid == true)
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = QueryProcedureHelper.SP_CHECK_ACCOUNT_LOGIN_VERIFY_USERNAME;
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue(Constants.p_Username, txtPrivilegedInfo);
                    cmd.Parameters.AddWithValue(Constants.p_Password, passUser);
                    conn.Open();
                }
                else
                {
                    throw new Exception("Data is not match.");
                }


                var checkAccount = cmd.ExecuteScalar();
                if (conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
                cmd.Parameters.Clear();
                // ConfirmationEmail
                if (Convert.ToInt32(checkAccount) == 1)
                {
                    using (MySqlConnection conn2 = new MySqlConnection(Constants.ConnsStrings))
                    {
                        using (MySqlCommand cmd2 = new MySqlCommand())
                        {
                            if (emailIsValid == true)
                            {
                                replaceText = txtPrivilegedInfo;

                                cmd2.Connection  = conn2;
                                cmd2.CommandText = QueryProcedureHelper.SP_USER_LOGIN;
                                cmd2.CommandType = System.Data.CommandType.StoredProcedure;
                                cmd2.Parameters.AddWithValue(Constants.p_Username, txtPrivilegedInfo.Equals(string.Empty));
                                cmd2.Parameters.AddWithValue(Constants.p_EmailAddress, replaceText);
                                cmd2.Parameters.AddWithValue(Constants.p_Password, passUser);
                                conn2.Open();
                                txtPrivilegedInfo = string.Empty;
                            }
                            else if (usernameIsValid == true)
                            {
                                cmd2.Connection  = conn2;
                                cmd2.CommandText = QueryProcedureHelper.SP_USER_LOGIN;
                                cmd2.CommandType = System.Data.CommandType.StoredProcedure;
                                cmd2.Parameters.AddWithValue(Constants.p_Username, txtPrivilegedInfo);
                                cmd2.Parameters.AddWithValue(Constants.p_EmailAddress, replaceText.Equals(string.Empty));
                                cmd2.Parameters.AddWithValue(Constants.p_Password, passUser);
                                conn2.Open();
                            }
                            else
                            {
                                throw new Exception("Data is null.");
                            }

                            using (MySqlDataReader reader = cmd2.ExecuteReader())
                            {
                                if (reader.HasRows)
                                {
                                    if (reader.Read())
                                    {
                                        if (txtPrivilegedInfo != "" || replaceText != "" && txtPassword != "")
                                        {
                                            DateTime?date = null;
                                            user = new UserLoginModel()
                                            {
                                                UserID        = reader["UserID"].Equals(DBNull.Value) == true ? 0 : Convert.ToInt32(reader["UserID"]),
                                                UserName      = reader["UserName"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["UserName"]),
                                                FirstName     = reader["FirstName"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["FirstName"]),
                                                PreferredName = reader["PreferredName"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["PreferredName"]),
                                                LastName      = reader["LastName"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["LastName"]),
                                                BirthDay      = reader["BirthDay"].Equals(DBNull.Value) == true ? date : Convert.ToDateTime(reader["BirthDay"]),
                                                PhoneNumber   = reader["PhoneNumber"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["PhoneNumber"]),
                                                Email         = reader["Email"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["Email"]),
                                                IsVerified    = reader["IsVerified"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["IsVerified"]),
                                                Password      = reader["Password"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["Password"]),
                                                UserActive    = reader["UserActive"].Equals(DBNull.Value) == true ? string.Empty : Convert.ToString(reader["UserActive"])
                                            };

                                            listUser.Add(user);
                                        }
                                    }
                                }
                                reader.Close();
                            }
                            conn2.Close();
                        }
                    }

                    if (user.UserName == txtPrivilegedInfo && user.Password == passUser)
                    {
                        string createPrivilegedAccess = AESSecurity.EncryptPassword(user.UserID.ToString()) + "_" + AESSecurity.EncryptPassword(user.UserName) + "_" + AESSecurity.EncryptPassword(user.Password);

                        CookieOptions cookieOptions = new CookieOptions();
                        cookieOptions.HttpOnly = false;
                        cookieOptions.Expires  = DateTime.Now.AddSeconds(180);
                        Response.Cookies.Append("privilege_access", createPrivilegedAccess, cookieOptions);

                        var modelObj = Newtonsoft.Json.JsonConvert.SerializeObject(user);
                        TempData["ModelUserDetail"] = modelObj;

                        return(RedirectToAction("Home", "Dashboard"));
                    }
                    else if (user.Email == replaceText && user.Password == passUser)
                    {
                        string createPrivilegedAccess = AESSecurity.EncryptPassword(user.UserID.ToString()) + "_" + AESSecurity.EncryptPassword(user.UserName) + "_" + AESSecurity.EncryptPassword(user.Password);

                        CookieOptions cookieOptions = new CookieOptions();
                        cookieOptions.HttpOnly = false;
                        cookieOptions.Expires  = DateTime.Now.AddSeconds(180);
                        Response.Cookies.Append("privilege_access", createPrivilegedAccess, cookieOptions);

                        var modelObj = Newtonsoft.Json.JsonConvert.SerializeObject(user);
                        TempData["ModelUserDetail"] = modelObj;

                        return(RedirectToAction("Home", "Dashboard"));
                    }
                    else
                    {
                        throw new Exception("Username, Email or Password is wrong, please check again.");
                    }
                }
                else if (Convert.ToInt32(checkAccount) == 0)
                {
                    string accNotVerify = "Account Unverified.";
                    string passText     = Newtonsoft.Json.JsonConvert.SerializeObject(accNotVerify);
                    TempData["_ifAccountCannotVerify"] = passText;

                    return(RedirectToAction("ConfirmationEmail", "Privileged"));
                }
                else
                {
                    throw new Exception("Your Account not been verified.");
                }
            }
            catch (MySqlException sqlEx)
            {
                ViewBag.SqlExceptionMessage = "Your Exception : " + sqlEx.Message.ToString();
            }
            catch (ArgumentException arEx)
            {
                ViewBag.ArgumentExceptionMessage = "Your Exception : " + arEx.Message.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("Check your data. " + ex.Message);
            }

            return(StatusCode(200));
        }
Example #15
0
    public void ChangeUserIsStageOpen(eStageKind _Kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        UserIsStageOpen[(int)_Kind] = AESSecurity.Encrypt_ToBytes_Aes <bool>(true, keyIV.Key, keyIV.IV);
    }
Example #16
0
    public bool GetUserStageBossClear(eStageKind _Kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptBoolFromBytes_Aes(UserStageBossClear[(int)_Kind], keyIV.Key, keyIV.IV));
    }
Example #17
0
    public void ChangeUserIsUnlockSkill(eHeroSkillKind _Kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        UserIsUnlockSkill[(int)_Kind] = AESSecurity.Encrypt_ToBytes_Aes <bool>(true, keyIV.Key, keyIV.IV);
    }
Example #18
0
    public bool GetUserIsStageOpen(eStageKind _kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptBoolFromBytes_Aes(UserIsStageOpen[(int)_kind], keyIV.Key, keyIV.IV));
    }
Example #19
0
    public bool GetUserIsUnlockSkill(eHeroSkillKind _kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptBoolFromBytes_Aes(UserIsUnlockSkill[(int)_kind], keyIV.Key, keyIV.IV));
    }
 internal byte[] EncryptBytes(byte[] bytes)
 {
     return(AESSecurity.EncryptBytes(bytes, SecuritySettings.Data.Key, SecuritySettings.Data.IV));
 }
Example #21
0
    public int GetUserBuildingLevel(eBuildingKind _Kind)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptIntFromBytes_Aes(UserBuildingLevel[(int)_Kind], keyIV.Key, keyIV.IV));
    }
Example #22
0
    public int GetUserJam()
    {
        //AESKeyAndIV keyIv = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptIntFromBytes_Aes(UserJam, keyIV.Key, keyIV.IV));
    }
Example #23
0
    public bool GetTutorialStoryClear(eStoryState _state)
    {
        //AESKeyAndIV keyIV = SaveSystem.LoadAESKeyAndIV();

        return(AESSecurity.DecryptBoolFromBytes_Aes(TutorialStoryClear[(int)_state], keyIV.Key, keyIV.IV));
    }