Exemple #1
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);
        }
        // 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;
        }