Ejemplo n.º 1
0
        private string GetCfg(string Key, bool Decrypt)
        {
            string empty = string.Empty;

            using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
            {
                GlobalConfig globalConfig = new GlobalConfig();
                globalConfig = rPMGlobalConfig.GetConfigRecord(Key);
                if (globalConfig != null)
                {
                    empty = globalConfig.Value;
                    if (Decrypt)
                    {
                        try
                        {
                            empty = CryptoIO.Decrypt(empty);
                        }
                        catch (Exception exception)
                        {
                            empty = string.Empty;
                        }
                    }
                }
            }
            return(empty);
        }
Ejemplo n.º 2
0
 public static void EnsureKeys()
 {
     GTA5Constants.PC_AES_KEY           = Resource.gtav_aes_key;
     GTA5Constants.PC_NG_KEYS           = CryptoIO.ReadNgKeys(Resource.gtav_ng_key);
     GTA5Constants.PC_NG_DECRYPT_TABLES = CryptoIO.ReadNgTables(Resource.gtav_ng_decrypt_tables);
     GTA5Constants.PC_LUT = Resource.gtav_hash_lut;
 }
Ejemplo n.º 3
0
        private static void LoadGTA5Keys()
        {
            string path = ".\\Keys";

            GTA5Keys.PC_AES_KEY           = File.ReadAllBytes(path + "\\gtav_aes_key.dat");
            GTA5Keys.PC_NG_KEYS           = CryptoIO.ReadNgKeys(path + "\\gtav_ng_key.dat");
            GTA5Keys.PC_NG_DECRYPT_TABLES = CryptoIO.ReadNgTables(path + "\\gtav_ng_decrypt_tables.dat");
            GTA5Keys.PC_NG_ENCRYPT_TABLES = CryptoIO.ReadNgTables(path + "\\gtav_ng_encrypt_tables.dat");
            GTA5Keys.PC_NG_ENCRYPT_LUTs   = CryptoIO.ReadNgLuts(path + "\\gtav_ng_encrypt_luts.dat");
            GTA5Keys.PC_LUT = File.ReadAllBytes(path + "\\gtav_hash_lut.dat");
        }
Ejemplo n.º 4
0
 public string GetLicenseData()
 {
     try
     {
         return(CryptoIO.Decrypt(context.Licenses.OrderByDescending(license => license.Timestamp).FirstOrDefault().LicData));
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Ejemplo n.º 5
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            string str = CryptoIO.MD5Encrypt(this.txtPwd.Text);

            if (Global.GlobalAccount.Password.Equals(str))
            {
                base.DialogResult = DialogResult.OK;
                base.Close();
            }
            this.Count++;
            this.txtPwd.Text = string.Empty;
            this.txtPwd.Select();
            if (this.Count > 3)
            {
                this.CancelPwd();
            }
        }
Ejemplo n.º 6
0
        public bool UpdateLicense(string data)
        {
            bool flag = false;

            try
            {
                string[] strArray1 = GetLicenseData().Split('|');
                string[] strArray2 = CryptoIO.Decrypt(data).Split('|');
                int      int32     = Convert.ToInt32(strArray2[2]);
                DateTime now       = DateTime.Now;
                using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
                {
                    GlobalConfig configRecord = rpmGlobalConfig.GetConfigRecord("PRODUCT_KEY");
                    string[]     strArray3    = CryptoIO.Decrypt(configRecord.Value).Split('|');
                    if (strArray2[0].Equals(strArray3[0]))
                    {
                        if (strArray2[1].Equals(strArray3[1]))
                        {
                            if (strArray3[1].Equals(strArray1[1]))
                            {
                                configRecord.Value = CryptoIO.Encrypt(string.Format("{0}|{1}", strArray3[0], now));
                                rpmGlobalConfig.SaveUpdate(configRecord);
                                rpmGlobalConfig.Save();
                                flag = true;
                            }
                        }
                    }
                }
                if (flag)
                {
                    using (new RPM_License())
                    {
                        License rec = new License();
                        rec.Timestamp = now;
                        Guid guid = Guid.NewGuid();
                        rec.LicData = CryptoIO.Encrypt(string.Format("{0}|{1}|{2}", guid, now, int32));
                        SaveUpdate(rec);
                        Save();
                    }
                }
            }
            catch
            {
            }
            return(flag);
        }
Ejemplo n.º 7
0
        private void btn_ChangePwd_Click(object sender, EventArgs e)
        {
            Guid id   = Global.GlobalAccount.Id;
            bool flag = false;

            if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("msg_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
            }
            else if (!Utility.CheckPassword(this.txtPwd1.Text))
            {
                MessageBox.Show(this, Utility.PwdMsg, "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
                return;
            }
            if (string.IsNullOrEmpty(this.txtPwd1.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdEmpty", "Password cannot be empty."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.txtPwd1.Select();
                return;
            }
            if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                this.txtPwd1.Select();
                return;
            }
            using (RPM_Account rPMAccount = new RPM_Account())
            {
                string str  = CryptoIO.MD5Encrypt(this.txtPwd1.Text);
                string str1 = CryptoIO.MD5Encrypt(this.txtOldPwd.Text);
                flag = rPMAccount.UpdatePassword(id, str1, str);
            }
            if (!flag)
            {
                MessageBox.Show(this, LangCtrl.GetString("txt_PwdNotChanged", "Password NOT changed. Please check old password."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            MessageBox.Show(this, LangCtrl.GetString("txt_PwdChanged", "Password changed."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            FormCtrl.ClearForm(this.MainPanel);
        }
Ejemplo n.º 8
0
 private void btn_OK_Click(object sender, EventArgs e)
 {
     if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text))
     {
         MessageBox.Show(this, LangCtrl.GetString("msg_PwdMatch", "Passwords do not match."), "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.txtPwd1.Select();
         return;
     }
     if (!Utility.CheckPassword(this.txtPwd1.Text))
     {
         MessageBox.Show(this, Utility.PwdMsg, "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.txtPwd1.Select();
         return;
     }
     if (!this.txtPwd1.Text.Equals(this.txtPwd2.Text) || string.IsNullOrEmpty(this.txtPwd1.Text))
     {
         MessageBox.Show(this, "Password Error", "Password", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         vTextBox _vTextBox  = this.txtPwd1;
         vTextBox _vTextBox1 = this.txtPwd2;
         string   empty      = string.Empty;
         string   str        = empty;
         _vTextBox1.Text = empty;
         _vTextBox.Text  = str;
         this.txtPwd1.Select();
     }
     else if (this.AccountID != Guid.Empty)
     {
         string str1 = CryptoIO.MD5Encrypt(this.txtPwd1.Text);
         using (RPM_Account rPMAccount = new RPM_Account())
         {
             Account account = rPMAccount.GetAccount(this.AccountID);
             account.Password   = str1;
             account.IsPwdReset = new bool?(false);
             rPMAccount.InsertUpdate(account);
             rPMAccount.Save();
         }
         base.DialogResult = DialogResult.OK;
         base.Close();
         return;
     }
 }
Ejemplo n.º 9
0
 private void LoadConfig()
 {
     using (RPM_GlobalConfig rPMGlobalConfig = new RPM_GlobalConfig())
     {
         GlobalConfig globalConfig = new GlobalConfig();
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_ACCOUNT_PATH");
         if (globalConfig != null)
         {
             this.AccountPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYSTEM_PATH");
         if (globalConfig != null)
         {
             this.SystemPath = globalConfig.Value;
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DB_ACCOUNT");
         if (globalConfig != null)
         {
             this.String_0 = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_DATABASE");
         if (globalConfig != null)
         {
             this.Database = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_PWD");
         if (globalConfig != null)
         {
             this.DBPwd = CryptoIO.Decrypt(globalConfig.Value);
         }
         globalConfig = rPMGlobalConfig.GetConfigRecord("REPORT_SYS_ENABLED");
         if (globalConfig != null)
         {
             this.IsEnabled = Convert.ToBoolean(globalConfig.Value);
         }
     }
 }
Ejemplo n.º 10
0
        public void CreateDefaultLicense()
        {
            License  rec = new License();
            DateTime now = DateTime.Now;

            rec.Timestamp = now;
            Guid guid = Guid.NewGuid();

            rec.LicData = CryptoIO.Encrypt(string.Format("{0}|{1}|1", guid, now));
            SaveUpdate(rec);
            Save();
            using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
            {
                rpmGlobalConfig.SaveUpdate(new GlobalConfig()
                {
                    Key        = "PRODUCT_KEY",
                    Value      = CryptoIO.Encrypt(string.Format("{0}|{1}", Guid.NewGuid(), now)),
                    IsEditable = false,
                    Desc       = "C3 Sentinel SKU Product ID",
                    DataType   = "STRING"
                });
                rpmGlobalConfig.Save();
            }
        }
Ejemplo n.º 11
0
        public string GetRequestKey(int Count)
        {
            string str         = string.Empty;
            string licenseData = GetLicenseData();

            if (!string.IsNullOrEmpty(licenseData))
            {
                string[] strArray1 = licenseData.Split('|');
                using (RPM_GlobalConfig rpmGlobalConfig = new RPM_GlobalConfig())
                {
                    str = rpmGlobalConfig.GetConfigValue("PRODUCT_KEY");
                    if (string.IsNullOrEmpty(str))
                    {
                        return(null);
                    }
                    string[] strArray2 = CryptoIO.Decrypt(str).Split('|');
                    if (strArray1[1].Equals(strArray2[1]))
                    {
                        str = CryptoIO.Encrypt(string.Format("{0}|{1}|{2}|{3}|{4}", DateTime.Now.Millisecond, strArray2[0], strArray1[1], DateTime.Now, Count));
                    }
                }
            }
            return(str);
        }
Ejemplo n.º 12
0
 private void AppLogin()
 {
     try
     {
         this.lbl_loginMsg.Text = LangCtrl.GetString("lbl_loginMsg", "Authenticating login...");
         this.lbl_loginMsg.Refresh();
         this.TryCount++;
         if (this.TryCount >= this.MaxTrys)
         {
             Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.LOGON_COUNT, this.vTextBox_0.Text, Guid.Empty);
             Process.GetCurrentProcess().Kill();
             base.DialogResult = DialogResult.Cancel;
             base.Close();
         }
         else
         {
             this.Cursor = Cursors.WaitCursor;
             using (RPM_Account rPMAccount = new RPM_Account())
             {
                 Account account = rPMAccount.Authenticate(vTextBox_0.Text, CryptoIO.MD5Encrypt(this.txtPwd.Text));
                 if (account == null)
                 {
                     Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.LOGON_FAILED, this.vTextBox_0.Text, Guid.Empty);
                 }
                 else
                 {
                     Global.LoginIDName   = (this.vTextBox_0.Text);
                     Global.GlobalAccount = account;
                     Global.RightsProfile = account.ApplicationRights;
                     this.Cursor          = Cursors.Default;
                     base.DialogResult    = DialogResult.OK;
                     if (account.IsPwdReset.Value)
                     {
                         PwdReset pwdReset = new PwdReset()
                         {
                             AccountID = account.Id
                         };
                         if (pwdReset.ShowDialog(this) == DialogResult.Cancel)
                         {
                             Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.PASSWORD, string.Concat("Password reset canceled: ", this.vTextBox_0.Text), account.Id);
                             base.DialogResult = DialogResult.Cancel;
                             base.Close();
                         }
                         Logger.Logging.WriteAccountLog(VMGlobal.LOG_ACTION.PASSWORD, string.Concat("Password reset: ", this.vTextBox_0.Text), account.Id);
                     }
                     base.DialogResult = DialogResult.OK;
                     base.Close();
                 }
             }
             this.Cursor = Cursors.Default;
         }
     }
     catch (Exception exception)
     {
     }
     if (!Global.LockLogin)
     {
         this.vTextBox_0.Text = string.Empty;
     }
     this.lbl_loginMsg.Text = string.Empty;
     this.txtPwd.Text       = string.Empty;
     this.vTextBox_0.Select();
     this.Cursor = Cursors.Default;
 }