Beispiel #1
0
        public virtual void AES256IGEDecrypt(string sourceFile, string destFile, byte[] iv, byte[] key)
        {
            int           num1;
            File          file   = new File(sourceFile);
            File          file2  = new File(destFile);
            AESFastEngine engine = new AESFastEngine();

            engine.init(false, new KeyParameter(key));
            byte[] buffer  = CryptoUtils.substring(iv, 0x10, 0x10);
            byte[] buffer2 = CryptoUtils.substring(iv, 0, 0x10);
            BufferedInputStream.__ <clinit>();
            BufferedInputStream  stream  = new BufferedInputStream(new FileInputStream(file));
            BufferedOutputStream stream2 = new BufferedOutputStream(new FileOutputStream(file2));

            byte[] buffer3 = new byte[0x10];
Label_0060:
            num1 = stream.read(buffer3);
            if (num1 <= 0)
            {
                stream2.flush();
                stream2.close();
                stream.close();
            }
            else
            {
                byte[] @in   = new byte[0x10];
                int    index = 0;
                while (true)
                {
                    if (index >= 0x10)
                    {
                        break;
                    }
                    @in[index] = (byte)((sbyte)(buffer3[index] ^ buffer[index]));
                    index++;
                }
                engine.processBlock(@in, 0, @in, 0);
                index = 0;
                while (true)
                {
                    if (index >= 0x10)
                    {
                        break;
                    }
                    @in[index] = (byte)((sbyte)(@in[index] ^ buffer2[index]));
                    index++;
                }
                buffer2 = buffer3;
                buffer  = @in;
                buffer3 = new byte[0x10];
                stream2.write(@in);
                goto Label_0060;
            }
        }
Beispiel #2
0
        public virtual void AES256IGEEncrypt(byte[] src, byte[] dest, int len, byte[] iv, byte[] key)
        {
            AESFastEngine engine = new AESFastEngine();

            engine.init(true, new KeyParameter(key));
            int num = len / 0x10;

            byte[] buffer  = iv;
            byte[] buffer2 = iv;
            int    num2    = 0x10;
            int    num3    = 0;

            for (int i = 0; i < num; i++)
            {
                int inOff = i * 0x10;
                int num6  = 0;
                while (true)
                {
                    if (num6 >= 0x10)
                    {
                        break;
                    }
                    dest[inOff + num6] = (byte)((sbyte)(src[inOff + num6] ^ buffer2[num3 + num6]));
                    num6++;
                }
                engine.processBlock(dest, inOff, dest, inOff);
                num6 = 0;
                while (true)
                {
                    if (num6 >= 0x10)
                    {
                        break;
                    }
                    dest[inOff + num6] = (byte)((sbyte)(dest[inOff + num6] ^ buffer[num2 + num6]));
                    num6++;
                }
                buffer  = src;
                num2    = inOff;
                buffer2 = dest;
                num3    = inOff;
            }
        }
Beispiel #3
0
        public virtual void AES256IGEDecrypt(byte[] src, byte[] dest, int len, byte[] iv, byte[] key)
        {
            int           expressionStack_AF_0;
            AESFastEngine engine = new AESFastEngine();

            engine.init(false, new KeyParameter(key));
            int num = len / 0x10;

            byte[] buffer  = iv;
            byte[] buffer2 = iv;
            int    num2    = 0x10;
            int    num3    = 0;
            int    num4    = 0;

Label_0029:
            if (num4 >= num)
            {
                return;
            }
            int inOff = num4 * 0x10;
            int num6  = 0;

            while (true)
            {
                if (num6 >= 0x10)
                {
                    break;
                }
                dest[inOff + num6] = (byte)((sbyte)(src[inOff + num6] ^ buffer[num2 + num6]));
                num6++;
            }
            engine.processBlock(dest, inOff, dest, inOff);
            num6 = 0;
            while (true)
            {
                if (num6 >= 0x10)
                {
                    break;
                }
                dest[inOff + num6] = (byte)((sbyte)(dest[inOff + num6] ^ buffer2[num3 + num6]));
                num6++;
            }
            buffer2 = src;
            num3    = inOff;
            buffer  = dest;
            num2    = inOff;
            if (0x1f != -1)
            {
                int expressionStack_AE_1 = num4;
                int expressionStack_AE_0 = 0x1f;
                expressionStack_AF_0 = expressionStack_AE_1 % expressionStack_AE_0;
                goto Label_00AF;
            }
            else
            {
                int expressionStack_A9_1 = num4;
            }
            expressionStack_AF_0 = 0;
Label_00AF:
            if (expressionStack_AF_0 == 0x20)
            {
                try
                {
                    Thread.sleep(10L);
                }
                catch (InterruptedException exception1)
                {
                    InterruptedException exception2 = ByteCodeHelper.MapException <InterruptedException>(exception1, 1);
                    Throwable.instancehelper_printStackTrace(exception2);
                }
            }
            num4++;
            goto Label_0029;
        }