title: SignedXml.CheckSignature fails in .NET 4 but it works in .NET 3.5, 3 or 2
body: <p>I have a response from a 3-rd party web service. I load an XmlDocument with that response.</p>
  
  <pre><code>  string txt = readStream.ReadToEnd();
    response = new XmlDocument();
    response.PreserveWhitespace = true;
    response.LoadXml(txt);   
    return response;
  </code></pre>
  
  <p>Now I would like to verify that the respones is signed using the certificate. I have a <code>VerifyXmlDoc(XmlDocument xmlDoc)</code> method which I have found on <a href="http://msdn.microsoft.com/" rel="noreferrer">msdn</a>.</p>
  
  <p>I know that the message is correct.</p>
  
  <pre><code>    public bool VerifyXmlDoc(XmlDocument xmlDoc)
      {
  
          SignedXml signed = new SignedXml(xmlDoc);
  
          XmlNodeList signatureNodeList = xmlDoc.GetElementsByTagName("Signature");
  
  
          signed.LoadXml((XmlElement)signatureNodeList[0]);
  
          X509Certificate2 serviceCertificate = null;
          foreach (KeyInfoClause clause in signed.KeyInfo)
          {
              if (clause is KeyInfoX509Data)
              {
                  if (((KeyInfoX509Data)clause).Certificates.Count &gt; 0)
                  {
                      serviceCertificate = (X509Certificate2)((KeyInfoX509Data)clause).Certificates[0];
                  }
              }
          }
  
  
          bool result = signed.CheckSignature(serviceCertificate, true);
          return result;
  
      }
  </code></pre>
  
  <p>If I set target framework of my project to .NET 3.5 or .NET 3, or .NET 2 it works great. Result is true. But if I change target framework to .NET 4 result is false. 
  (And I have to use .NET 4)</p>
  
  <p>Any ideas on how to solve this problem?</p>