title: Program crashing when Applying SHA-256/SHA-512 instead of SHA-1 when signing documents with RSA
body: <p>First I generate a Signature and place in the txt_EmpSignature text box and then to sign documents i'm using the following argument in the "Sign" button click event handler:  </p>
  
  <pre><code>RSACryptoServiceProvider MySigner = new RSACryptoServiceProvider();
  openFileToSign.ShowDialog();
  FileStream file_to_sign = new FileStream(openFileToSign.FileName, FileMode.Open, FileAccess.Read);
  BinaryReader reader_to_sign = new BinaryReader(file_to_sign);
  
  byte[] data_to_sign = reader_to_sign.ReadBytes((int)file_to_sign.Length);
  MySigner.FromXmlString(txt_EmpSignature.Text);
  SHA1CryptoServiceProvider SHA = new SHA1CryptoServiceProvider();
  byte[] signature_to_sign = MySigner.SignData(data_to_sign,SHA);
  UTF8Encoding UTF = new UTF8Encoding();
  txt_DocSignature.Text = Convert.ToBase64String(signature_to_sign);
  reader_to_sign.Close();
  file_to_sign.Close();  
  </code></pre>
  
  <p>Then when I replace the "SHA1CryptoServiceProvider" with "SHA256CryptoServiceProvider" I get an unhandled exception that i couldn't specify!<br>
  Is there any difference when handling SHA-2 algorthims instead of SHA-1?  </p>
  
  <h3><b>EDIT1:</b></h3>  
  
  <p>The Exception happens when I specify the file and click "Open" in the "openFileToSign" Open File Dialogue. And I'm working on "WINDOWS 7"    </p>
  
  <p><b>EDIT2:</b>    </p>
  
  <p>The Exception message says "Value was invalid"<br>
  and the exception happenes in the line: </p>
  
  <pre><code>byte[] signature_to_sign = MySigner.SignData(data_to_sign,SHA);
  </code></pre>