title: How to decode a string of text from a Base64 to a byte array, and the get the string property of this byte array without data corruption
body: <p>Ok so I have a string of text, encoded in Base 64 like below:</p>
  
  <pre><code>string myText = "abcBASE64TEXTGOESHEREdef==";  // actual string is 381 characters long with trailing '=='
  </code></pre>
  
  <p>I then convert my string from Base 64 to a byte array like so:</p>
  
  <pre><code>byte[] decodedFromBase64 = Convert.FromBase64String(myText);
  </code></pre>
  
  <p>At this point, I want to get the string value of this byte array and save this in a text file <strong>without data loss or corruption</strong>. The code below doesn't seem to be doing it:</p>
  
  <pre><code>string myDecodedText = Encoding.ASCII.GetString(decodedFromBase64);
  StreamWriter myStreamWriter = new StreamWriter("C:\\OpenSSL-Win32\\bin\\textToDecrypt.txt");
  myStreamWriter.Write(myString);
  myStreamWriter.Flush();
  myStreamWriter.Close();
  </code></pre>
  
  <p>Can somebody please tell me where I'm going wrong.</p>
  
  <p>Edit: The output is unreadable, I need to take the decoded string and then use OpenSSL to decrypt it. The Output and the result from OpenSSL are both below:</p>
  
  <p><img src="https://i.stack.imgur.com/ID5i0.jpg" alt="Output"></p>
  
  <p><img src="https://i.stack.imgur.com/UJfwH.jpg" alt="OpenSSL"></p>