title: Strong and simple to implement encryption techniques in .NET?
body: <p>I am working over one my student project over .Net4 and MVC3.
  Project is almost at completion except some security features such as Encoding/Decoding information for saving in config file such as Connection String etc.</p>
  
  <p>I want to avoid a very complex solution and so I am looking for some easy to use Encryption technique in .NET ideally something where I can just provide a KEY and String and it gives me back the encoded text and vice versa (similar to the Base64 example given below).</p>
  
  <p>I went through MSDN’s <a href="http://msdn.microsoft.com/en-us/library/9eat8fht.aspx" rel="nofollow">System.Security.Cryptography</a> Namespace documentation online but it has a lot of options for a newbie like me I guess.</p>
  
  <p>Kindly provide me with suggestions and path to follow to achieve it.
  Thank you. </p>
  
  <hr>
  
  <p>While searching I found a simple solution of Base64 which I implemented like this:</p>
  
  <pre><code>    static public string EncodeTo64(string toEncode)
      {
          byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
          string encodedValue = System.Convert.ToBase64String(toEncodeAsBytes);
          return encodedValue;
      }
  
      static public string DecodeFrom64(string toDecode)
      {
          var toDecodeAsString = System.Convert.FromBase64String(toDecode);
          string decodedValue = System.Text.ASCIIEncoding.ASCII.GetString(toDecodeAsString);
          return decodedValue;
      }
  </code></pre>
  
  <p>Works fine but the problem is as far as I’ve understood this is not something very reliable as a static encoding technique (one without a custom KEY) can be easily decoded and so many online base 64 decoders are available on net. I also tried to work with <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.aescryptoserviceprovider.aspx" rel="nofollow">AES as expalined here</a> but failed to succeed.</p>