Esempio n. 1
0
        public void Initialize(byte[] sessionKey, byte[] clientSeed, byte[] serverSeed)
        {
            IsInitialized = false;

            if (IsInitialized)
            {
                throw new InvalidOperationException("PacketCrypt already initialized!");
            }

            SARC4Encrypt = new SARC4();
            SARC4Decrypt = new SARC4();

            var decryptSHA1 = new HMACSHA1(serverSeed);
            var encryptSHA1 = new HMACSHA1(clientSeed);

            SARC4Encrypt.PrepareKey(encryptSHA1.ComputeHash(sessionKey));
            SARC4Decrypt.PrepareKey(decryptSHA1.ComputeHash(sessionKey));

            var PacketEncryptionDummy = new byte[0x400];
            var PacketDecryptionDummy = new byte[0x400];

            SARC4Encrypt.ProcessBuffer(PacketEncryptionDummy, PacketEncryptionDummy.Length);
            SARC4Decrypt.ProcessBuffer(PacketDecryptionDummy, PacketDecryptionDummy.Length);

            IsInitialized = true;
        }
Esempio n. 2
0
        public BNetCrypt(byte[] sessionKey)
        {
            this.IsInitialized = false;
            if (this.IsInitialized)
            {
                throw BNetCrypt.smethod_0(Module.smethod_36 <string>(56398324u));
            }
            this.SARC4Encrypt = new SARC4();
            this.SARC4Decrypt = new SARC4();
            HMACSHA256 hashAlgorithm_  = BNetCrypt.smethod_1(sessionKey);
            HMACSHA256 hashAlgorithm_2 = BNetCrypt.smethod_1(sessionKey);

            this.SARC4Encrypt.PrepareKey(BNetCrypt.smethod_2(hashAlgorithm_2, BNetCrypt.ServerEncryptionKey));
            this.SARC4Decrypt.PrepareKey(BNetCrypt.smethod_2(hashAlgorithm_, BNetCrypt.ServerDecryptionKey));
            this.IsInitialized = true;
        }
Esempio n. 3
0
        public BNetCrypt(byte[] sessionKey)
        {
            IsInitialized = false;

            if (IsInitialized)
                throw new InvalidOperationException("PacketCrypt already initialized!");

            SARC4Encrypt = new SARC4();
            SARC4Decrypt = new SARC4();

            var DecryptSHA256 = new HMACSHA256(sessionKey);
            var EncryptSHA256 = new HMACSHA256(sessionKey);

            SARC4Encrypt.PrepareKey(EncryptSHA256.ComputeHash(ServerEncryptionKey));
            SARC4Decrypt.PrepareKey(DecryptSHA256.ComputeHash(ServerDecryptionKey));

            IsInitialized = true;
        }
Esempio n. 4
0
        public BNetCrypt(byte[] sessionKey)
        {
            IsInitialized = false;

            if (IsInitialized)
            {
                throw new InvalidOperationException("PacketCrypt already initialized!");
            }

            SARC4Encrypt = new SARC4();
            SARC4Decrypt = new SARC4();

            var DecryptSHA256 = new HMACSHA256(sessionKey);
            var EncryptSHA256 = new HMACSHA256(sessionKey);

            SARC4Encrypt.PrepareKey(EncryptSHA256.ComputeHash(ServerEncryptionKey));
            SARC4Decrypt.PrepareKey(DecryptSHA256.ComputeHash(ServerDecryptionKey));

            IsInitialized = true;
        }
Esempio n. 5
0
        public void Initialize(byte[] sessionKey, byte[] clientSeed, byte[] serverSeed)
        {
            IsInitialized = false;

            if (IsInitialized)
                throw new InvalidOperationException("PacketCrypt already initialized!");

            SARC4Encrypt = new SARC4();
            SARC4Decrypt = new SARC4();

            var decryptSHA1 = new HMACSHA1(serverSeed);
            var encryptSHA1 = new HMACSHA1(clientSeed);

            SARC4Encrypt.PrepareKey(encryptSHA1.ComputeHash(sessionKey));
            SARC4Decrypt.PrepareKey(decryptSHA1.ComputeHash(sessionKey));

            var PacketEncryptionDummy = new byte[0x400];
            var PacketDecryptionDummy = new byte[0x400];

            SARC4Encrypt.ProcessBuffer(PacketEncryptionDummy, PacketEncryptionDummy.Length);
            SARC4Decrypt.ProcessBuffer(PacketDecryptionDummy, PacketDecryptionDummy.Length);

            IsInitialized = true;
        }
Esempio n. 6
0
 public Warden()
 {
     _inputCrypto  = new SARC4();
     _outputCrypto = new SARC4();
     _checkTimer   = 10 * Time.InMilliseconds;
 }
Esempio n. 7
0
        public void Initialize(byte[] sessionKey, byte[] clientSeed, byte[] serverSeed)
        {
            this.IsInitialized = false;
            if (this.IsInitialized)
            {
                goto IL_E2;
            }
            goto IL_11E;
            uint arg_EC_0;

            while (true)
            {
IL_E7:
                uint num;
                switch ((num = (arg_EC_0 ^ 411909969u)) % 9u)
                {
                case 0u:
                    goto IL_E2;

                case 1u:
                {
                    byte[] array = new byte[1024];
                    arg_EC_0 = (num * 4112686248u ^ 3760825414u);
                    continue;
                }

                case 2u:
                {
                    byte[] array2;
                    this.SARC4Encrypt.ProcessBuffer(array2, array2.Length);
                    arg_EC_0 = (num * 3888587318u ^ 4000620574u);
                    continue;
                }

                case 3u:
                {
                    this.SARC4Decrypt = new SARC4();
                    HMACSHA1 hashAlgorithm_  = WoWCrypt.smethod_1(serverSeed);
                    HMACSHA1 hashAlgorithm_2 = WoWCrypt.smethod_1(clientSeed);
                    arg_EC_0 = (num * 2152563200u ^ 767503809u);
                    continue;
                }

                case 5u:
                {
                    HMACSHA1 hashAlgorithm_2;
                    this.SARC4Encrypt.PrepareKey(WoWCrypt.smethod_2(hashAlgorithm_2, sessionKey));
                    HMACSHA1 hashAlgorithm_;
                    this.SARC4Decrypt.PrepareKey(WoWCrypt.smethod_2(hashAlgorithm_, sessionKey));
                    byte[] array2 = new byte[1024];
                    arg_EC_0 = (num * 2323342343u ^ 3057383575u);
                    continue;
                }

                case 6u:
                {
                    byte[] array;
                    this.SARC4Decrypt.ProcessBuffer(array, array.Length);
                    this.IsInitialized = true;
                    arg_EC_0           = (num * 162284483u ^ 1051040720u);
                    continue;
                }

                case 7u:
                    goto IL_11E;

                case 8u:
                    goto IL_130;
                }
                break;
            }
            return;

IL_130:
            throw WoWCrypt.smethod_0(Module.smethod_35 <string>(3386492916u));
IL_E2:
            arg_EC_0 = 1557707004u;
            goto IL_E7;
IL_11E:
            this.SARC4Encrypt = new SARC4();
            arg_EC_0          = 564654211u;
            goto IL_E7;
        }
Esempio n. 8
0
        public void Initialize(byte[] sessionKey)
        {
            this.IsInitialized = false;
            while (true)
            {
IL_12E:
                uint arg_101_0 = 2073740479u;
                while (true)
                {
                    uint num;
                    switch ((num = (arg_101_0 ^ 2103882194u)) % 8u)
                    {
                    case 0u:
                    {
                        byte[] array  = new byte[1024];
                        byte[] array2 = new byte[1024];
                        this.SARC4Encrypt.ProcessBuffer(array, array.Length);
                        this.SARC4Decrypt.ProcessBuffer(array2, array2.Length);
                        this.IsInitialized = true;
                        arg_101_0          = (num * 483766584u ^ 1925911129u);
                        continue;
                    }

                    case 1u:
                    {
                        this.SARC4Decrypt = new SARC4();
                        HMACSHA1 hashAlgorithm_  = WoWCrypt.smethod_1(WoWCrypt.ServerDecryptionKey);
                        HMACSHA1 hashAlgorithm_2 = WoWCrypt.smethod_1(WoWCrypt.ServerEncryptionKey);
                        arg_101_0 = (num * 1947262690u ^ 1312804196u);
                        continue;
                    }

                    case 2u:
                        goto IL_12E;

                    case 4u:
                    {
                        HMACSHA1 hashAlgorithm_2;
                        this.SARC4Encrypt.PrepareKey(WoWCrypt.smethod_2(hashAlgorithm_2, sessionKey));
                        HMACSHA1 hashAlgorithm_;
                        this.SARC4Decrypt.PrepareKey(WoWCrypt.smethod_2(hashAlgorithm_, sessionKey));
                        arg_101_0 = (num * 1816278399u ^ 758351854u);
                        continue;
                    }

                    case 5u:
                        arg_101_0 = (((!this.IsInitialized) ? 3269098579u : 2838635962u) ^ num * 4003455326u);
                        continue;

                    case 6u:
                        goto IL_135;

                    case 7u:
                        this.SARC4Encrypt = new SARC4();
                        arg_101_0         = 946657131u;
                        continue;
                    }
                    goto Block_2;
                }
            }
Block_2:
            return;

IL_135:
            throw WoWCrypt.smethod_0(Module.smethod_35 <string>(3386492916u));
        }