title: How to edit and read the header of a MP3 file before encrypting it in c#?
body: <p>I am encrypting an MP3 file into another format, what i want is, i should be able to write the header of the new format file. And i want to save the duration of the song in the header of the new format file. As the new file will be in encrypted format, so i want to write the duration in the header. So later on if i need the duration of the encrypted song file, i will just read the header instead of decrypting the whole file.</p>
  
  <p>I am writing the code of my mp3 encryption technique.</p>
  
  <pre><code>public static void EncryptFile(string inputFile, string outputFile)
         {
  
             try
             {
                 string password = @"myKey123"; // Your Key Here
                 UnicodeEncoding UE = new UnicodeEncoding();
                 byte[] key = UE.GetBytes(password);
  
                 string cryptFile = outputFile;
                 FileStream fsCrypt = new FileStream(cryptFile, FileMode.Create);
  
                 RijndaelManaged RMCrypto = new RijndaelManaged();
  
                 CryptoStream cs = new CryptoStream(fsCrypt,
                     RMCrypto.CreateEncryptor(key, key),
                     CryptoStreamMode.Write);
  
                 FileStream fsIn = new FileStream(inputFile, FileMode.Open);
  
                 int data;
                 while ((data = fsIn.ReadByte()) != -1)
                     cs.WriteByte((byte)data);
  
  
                 fsIn.Close();
                 cs.Close();
                 fsCrypt.Close();
             }
             catch
             {
                 Console.WriteLine("Encryption failed!", "Error");
             }
         }
  </code></pre>