0
Answer

Encrypt and Decrypt swf

Ask a question

hi

i am using this code. i have run the project encrypt in Successful. but how to decrypt kindly help me.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using AxShockwaveFlashObjects;
using System.Runtime.CompilerServices;

namespace T4_1
{
  public partial class Form1 : Form
  {
  string path1 = @"C:\Documents and Settings\paramesh\Desktop\EN_test\E06_01.swf";

  public Form1()
  {
  InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
  // CodeWithCleanup();
  decrypt_fun();

  axShockwaveFlash1.Movie = path1;
  // RuntimeHelpers.TryCode tryCode = new RuntimeHelpers.TryCode();
  }
  //==================================
  public void CodeWithCleanup()
  {
  System.IO.FileStream file = null;
  System.IO.FileInfo fileInfo = null;

  try
  {
  fileInfo = new System.IO.FileInfo(path1);

  file = fileInfo.OpenWrite();
  file.WriteByte(0xF);
  }
  catch (System.UnauthorizedAccessException e)
  {
  System.Console.WriteLine(e.Message);
  }
  finally
  {
  if (file != null)
  {
  file.Close();
  }
 
  }
 
  }

  //=============================================
  public void decrypt_fun()
  {
  //
  // Read the contents of Encoded Bitmap from the text file.
  //
  TextReader reader = new StreamReader(path1);
  String imageString = reader.ReadLine();

  //
  // Decode the Base64-Encoded binary whic previously read from the
  // text file above.
  //
  byte[] imageBytes = Convert.FromBase64String(imageString);
  //
  // Create a new image file.
  //
  FileStream fs = new FileStream(path1, FileMode.Create, FileAccess.Write);
  BinaryWriter writer = new BinaryWriter(fs);

  try
  {
  for (int i = 0; i < imageBytes.Length; i++)
  {
  writer.Write(imageBytes[i]);
  }
  }
  finally
  {
  writer.Close();
  fs.Close();
  }

  Console.ReadLine();
  }

  //======================================

 
  }
}