private static void RijndaelEncrypt(byte[] array, string key, MemoryStream toWriteTo)
        {
            Rijndael           algorithm = Rijndael.Create();
            Rfc2898DeriveBytes rdb       = new Rfc2898DeriveBytes(key, DMW_SALT);

            algorithm.Padding = PaddingMode.ISO10126;
            algorithm.Key     = rdb.GetBytes(32);
            algorithm.IV      = rdb.GetBytes(16);

            ICryptoTransform ict = algorithm.CreateEncryptor();

            using (MemoryStream ms = new MemoryStream())
            {
                using (CryptoStream cs = new CryptoStream(ms, ict, CryptoStreamMode.Write))
                {
                    cs.WriteString("Rijndael");
                    cs.Write(array, 0, array.Length);
                    cs.FlushFinalBlock();
                    ms.Position = 0;
                    ms.CopyTo(toWriteTo);
                    cs.Close();
                }
            }
        }