Ejemplo n.º 1
0
        int[] decrypt(int[] data)
        {
            var memStream = new MemoryStream();
            var writer    = new BinaryWriter(memStream);

            foreach (var value in data)
            {
                writer.Write(value);
            }
            byte[] decrypted;
            try {
                decrypted = DeobUtils.aesDecrypt(memStream.ToArray(), decryptMethod.Key, decryptMethod.Iv);
            }
            catch {
                return(null);
            }
            if (decrypted.Length / 4 * 4 != decrypted.Length)
            {
                return(null);
            }
            var newData = new int[decrypted.Length / 4];

            for (int i = 0; i < newData.Length; i++)
            {
                newData[i] = BitConverter.ToInt32(decrypted, i * 4);
            }
            return(newData);
        }
Ejemplo n.º 2
0
        public string decrypt(MethodDef method, int offset)
        {
            var info = getDecrypterInfo(method);

            if (info.key == null)
            {
                int length = BitConverter.ToInt32(decryptedData, offset);
                return(Encoding.Unicode.GetString(decryptedData, offset + 4, length));
            }
            else
            {
                byte[] encryptedStringData;
                if (stringDecrypterVersion == StringDecrypterVersion.VER_37)
                {
                    int fileOffset = BitConverter.ToInt32(decryptedData, offset);
                    int length     = BitConverter.ToInt32(fileData, fileOffset);
                    encryptedStringData = new byte[length];
                    Array.Copy(fileData, fileOffset + 4, encryptedStringData, 0, length);
                }
                else if (stringDecrypterVersion == StringDecrypterVersion.VER_38)
                {
                    uint rva    = BitConverter.ToUInt32(decryptedData, offset);
                    int  length = peImage.readInt32(rva);
                    encryptedStringData = peImage.readBytes(rva + 4, length);
                }
                else
                {
                    throw new ApplicationException("Unknown string decrypter version");
                }

                return(Encoding.Unicode.GetString(DeobUtils.aesDecrypt(encryptedStringData, info.key, info.iv)));
            }
        }
        static byte[] decrypt(PasswordInfo password, byte[] data)
        {
            const int iterations = 2;
            const int numBits    = 0x100;
            var       key        = new Rfc2898DeriveBytes(password.passphrase, Encoding.UTF8.GetBytes(password.salt), iterations).GetBytes(numBits / 8);

            return(DeobUtils.aesDecrypt(data, key, Encoding.UTF8.GetBytes(password.iv)));
        }
Ejemplo n.º 4
0
        public byte[] decrypt()
        {
            if (encryptedDataResource == null || key == null || iv == null)
            {
                throw new ApplicationException("Can't decrypt resource");
            }

            return(DeobUtils.aesDecrypt(encryptedDataResource.GetResourceData(), key, iv));
        }
Ejemplo n.º 5
0
        UnpackedFile unpackEmbeddedFile(int index, ApplicationModeDecrypter decrypter)
        {
            uint offset = 0;

            for (int i = 0; i < index + 1; i++)
            {
                offset += sizes[i];
            }
            string filename = Win32Path.GetFileName(filenames[index]);
            var    data     = peImage.offsetReadBytes(offset, (int)sizes[index + 1]);

            data = DeobUtils.aesDecrypt(data, decrypter.AssemblyKey, decrypter.AssemblyIv);
            data = decompress(data);
            return(new UnpackedFile(filename, data));
        }
Ejemplo n.º 6
0
 static byte[] decrypt2(byte[] data)
 {
     return(DeobUtils.aesDecrypt(data, key2, iv2));
 }
Ejemplo n.º 7
0
 static byte[] decrypt1(byte[] data)
 {
     return(DeobUtils.aesDecrypt(data, key1, iv1));
 }
Ejemplo n.º 8
0
        byte[] decrypt(byte[] encrypted)
        {
            var keyGenerator = new PasswordDeriveBytes(resourcePassword, Encoding.ASCII.GetBytes(resourceSalt));

            return(DeobUtils.inflate(DeobUtils.aesDecrypt(encrypted, keyGenerator.GetBytes(32), keyGenerator.GetBytes(16)), false));
        }