title: Error in password decryption
body: <p>I have to store the password field in SQL Server database in an encrypted format and I have to decrypt it while the user is logging into the system. The encryption part is working fine. But I am getting the error in decryption part as "Invalid length for a Base-64 char array" at the line   </p>
  
  <pre><code>byte[] todecode_byte = Convert.FromBase64String(encryptpwd);   
  </code></pre>
  
  <p>of decryption module.</p>
  
  <pre><code>private string Encryptdata(string password)
  {
          string encryptpwd = string.Empty;
          byte[] encode = new byte[password.Length];
          encode = Encoding.UTF8.GetBytes(password);
          encryptpwd = Convert.ToBase64String(encode);
          return encryptpwd;
  }
  
  private string Decryptdata(string encryptpwd)
  {
          string decryptpwd = string.Empty;
          UTF8Encoding encodepwd = new UTF8Encoding();
          Decoder Decode = encodepwd.GetDecoder();
          byte[] todecode_byte = Convert.FromBase64String(encryptpwd); //here I am getting error as "Invalid length for a Base-64 char array"
          int charCount = Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
          char[] decoded_char = new char[charCount];
          Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
          decryptpwd = new String(decoded_char);
          return decryptpwd;
  }
  </code></pre>
  
  <p>Input Data: <code>prabu</code><br>
  Encrypted Data: <code>cHJhYnU=</code></p>