Example #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;
            }
        }