示例#1
0
文件: License.cs 项目: Nekohim3/BDOA
 public License(string url)
 {
     _url  = url;
     _hwid = GameNet.GetHwid();
     CheckLicense();
     _timer   = new System.Threading.Timer(CheckLicense, null, 1000 * 60, 1000 * 60);
     _timerhw = new System.Threading.Timer(HwidCheck, null, 1000 * 30, 1000 * 30);
 }
示例#2
0
文件: License.cs 项目: Nekohim3/BDOA
        private static void Register(string nick)
        {
            try
            {
                const string pubKeyNotXoRed =
                    "<RSAKeyValue><Modulus>wzzpNEbNjAWLI3AgFLb0YZ8gjqqmIgD1rTU3xy25IuetNsA5QKJxP7whwKq2LF4ul56LhxG3M3Wxhr/kZOgXWbPjEG1zyB7Lx83B65z6CFRIV5llzZziq6/uZP2cEHfwF62/letOD+tUaVvsi4/jvVv5NEanfeoXIQ1cbSBuWaEXfNpra48lmAZpTSLu93l9o+ooJsyrwBBHwWrS3/ljE/19PF4SetqNvUi7FpsrtB5emsG26M7AYiEv/lN2oJlOMU4+yJa/na+LZEdjSsG7yUiSTu2r23ixQlfKbGLwCDtP3VLgf2wrptq7KCIaYrQIznl/kON7CeHT10kKvcjAPQ==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>";
                var curRandom = new Random();
                var preKey    = RandomStringWithNumbers(curRandom.Next(15, 21), curRandom);
                var xoRkey    = curRandom.Next(1, int.MaxValue);
                var pubKey    = DigitalSign.Xor(pubKeyNotXoRed, xoRkey);

                var token         = curRandom.Next(1000000, int.MaxValue);
                var infoXoRed     = DigitalSign.Xor(Info(token, preKey), xoRkey);
                var responseXoRed =
                    DigitalSign.Xor(
                        GetRequest(DigitalSign.Xor(infoXoRed, xoRkey)), xoRkey);
                var responseSplitted = DigitalSign.Xor(responseXoRed, xoRkey)
                                       .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                if (responseSplitted[0].Split('=')[1] != "2")
                {
                    return;
                }
                if (int.Parse(DigitalSign.DecryptString(responseSplitted[4], preKey)) != token)
                {
                    return;
                }
                if (GameNet.GetHwid() != Encoding.UTF8.GetString(
                        Convert.FromBase64String(
                            responseSplitted[1].Split(new[] { '[', ']' },
                                                      StringSplitOptions.RemoveEmptyEntries)[0])))
                {
                    return;
                }
                if (!DigitalSign.CompareRsaMethod(GetSignedText(responseSplitted),
                                                  responseSplitted[responseSplitted.Length - 1].Split(new[] { '[', ']' },
                                                                                                      StringSplitOptions.RemoveEmptyEntries)[0], DigitalSign.Xor(pubKey, xoRkey)))
                {
                    return;
                }
                _lic = false;
            }
            catch (Exception e)
            {
                if (!_lic)
                {
                    MessageBox.Show(@"Не удается связвться с сервером авторизации");
                    Process.GetCurrentProcess().Kill();
                }
            }
        }
示例#3
0
文件: License.cs 项目: Nekohim3/BDOA
 internal string GetHwid() => GameNet.GetHwid();
示例#4
0
文件: License.cs 项目: Nekohim3/BDOA
 private static void HwidCheck(object o = null) => GameNet.GetHwid();