title: Why is this X.509 certificate considered invalid?
body: <p>I have a given certificate installed on my server. That certificate has valid dates, and seems perfectly valid in the Windows certificates MMC snap-in.</p>
  
  <p>However, when I try to read the certificate, in order to use it in an HttpRequest, I can't find it. Here is the code used:</p>
  
  <pre><code>    X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
      store.Open(OpenFlags.ReadOnly); X509Certificate2Collection col =
      store.Certificates.Find(X509FindType.FindBySerialNumber, "xxx", true);
  </code></pre>
  
  <p><code>xxx</code> is the serial number; the argument <code>true</code> means "only valid certificates". The returned collection is empty.</p>
  
  <p>The strange thing is that if I pass <code>false</code>, indicating invalid certificates are acceptable, the collection contains one element&mdash;the certificate with the specified serial number.</p>
  
  <p>In conclusion: the certificate appears valid, but the <code>Find</code> method treats it as invalid! Why?</p>