title: Do i need to call the class "File Stream" to encrypt the data in a file?
body: <p>I made a program that iterates through a directory, finds files with a specific extension, and then encrypts it. Although it's not encrypting the actual file, it's encrypting the file directory.
  It is a console application that shows the encrypted message and the decrypted message as well.
  here is the core part of the code</p>
  <pre><code>static void Main(string[] args)
  {
      string root = @&quot;C:\Users\Owner\Documents&quot;;
      var files = from file in Directory.EnumerateFiles(root) select file;
      foreach (var file in files)
      {
          if (file.EndsWith(&quot;.txt&quot;))
          {
              try
              {
                  // Create Aes that generates a new key and initialization vector (IV).    
                  // Same key must be used in encryption and decryption    
                  using (AesManaged aes = new AesManaged())
                  {
                      // Encrypt string    
                      byte[] encrypted = Encrypt(file, aes.Key, aes.IV);
                      // Print encrypted string    
                      Console.WriteLine($&quot;Encrypted data: {System.Text.Encoding.UTF8.GetString(encrypted)}&quot;);
                      // Decrypt the bytes to a string.    
                      string decrypted = Decrypt(encrypted, aes.Key, aes.IV);
                      // Print decrypted string. It should be same as raw data    
                      Console.WriteLine($&quot;Decrypted data: {decrypted}&quot;);
                  }
              }
              catch (Exception exp)
              {
                  Console.WriteLine(exp.Message);
              }
              Console.ReadKey();
          }
  </code></pre>
  <p>output:</p>
  <p>Encrypted data: ?U↔C?♣#Y?f&quot;?8?a?*????♦????&amp;?,¶?</p>
  <p>Decrypted data: C:\Users\Owner\Documents\script.txt</p>
  <p>I go into the file and nothing is encrypted inside it</p>