title: Find WCF service certificate, using several search criteria in config file
body: <p>I'm wondering, is there any way to find WCF service certificate, using several search criteria in <code>.config</code> file?</p>
  
  <p>E.g., if I want to find certificate by subject name, then my config will contain these lines:</p>
  
  <pre><code>        &lt;serviceCertificate findValue="host.domain.com"
                              storeLocation="LocalMachine"
                              storeName="My"
                              x509FindType="FindBySubjectName"/&gt;
  </code></pre>
  
  <p>And what should I put in the config file, if I want to find a certificate by subject name <strong>and</strong> by application policy?</p>
  
  <p>I know, that <code>X509Certificate2Collection</code> class <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate2collection.find" rel="nofollow">allows</a> this:  </p>
  
  <pre><code>            return store
                  .Certificates
                  .Find(X509FindType.FindByApplicationPolicy, "1.3.6.1.5.5.7.3.1", false)
                  .Find(X509FindType.FindBySubjectName, "host.domain.com", false)
                  .Cast&lt;X509Certificate2&gt;()
                  .SingleOrDefault();
  </code></pre>
  
  <p>And what about <code>.config</code>-files?</p>