title: string to byte array (to string to XML) and back again
body: <p>i know there are 1million questions about "string - byte array" conversion out there but none of them fit my problem.</p>
  
  <p>For the installation of my software i need to save some informations from the user (serveraddress, userID, password and so on). Some of these informations need do be protected (encrypted using DPAPI). For that i have to convert the <code>string</code> (<code>SecureString</code>) to <code>byte[]</code> </p>
  
  <pre><code>public static byte[] StringToByte(string s)
  {
      return Convert.FromBase64String(s);
  }
  </code></pre>
  
  <p>where i get my first problem. If the strings lenght is a not a multiple of 4 (<code>s.lenght % 4 == 0</code>) i get a "Invalid length for a Base-64 char array" error. I've read that i can (have to) add "=" to the end of the <code>string</code> but some of these strings may be passwords (which may contain "="). I need to store the (encrypted) data in a XML-file why i can't use Unicode encoding (i don't know why but it corrupts the XML file ... because of encoding i would suppose).</p>
  
  <p>As last step i have to go back the way to get the stored data on app startup.</p>
  
  <p>Does someone of you can help me solving this problem ? I don't care the output in the XML as long as it is "readable".</p>
  
  <p>best regards Alex</p>