<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>typeof(Blog); &#187; certificates</title>
	<atom:link href="http://blog.reveille.org.uk/tag/certificates/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.reveille.org.uk</link>
	<description>.net development thoughts and others</description>
	<lastBuildDate>Sat, 11 Sep 2010 15:48:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title>WCF Configuration &#8211; Referencing certificates with long subjects</title>
		<link>http://blog.reveille.org.uk/2010/01/wcf-configuration-certificates/</link>
		<comments>http://blog.reveille.org.uk/2010/01/wcf-configuration-certificates/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 11:09:20 +0000</pubDate>
		<dc:creator>Graham Clark</dc:creator>
				<category><![CDATA[coding problems]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[wcf]]></category>

		<guid isPermaLink="false">http://blog.reveille.org.uk/?p=63</guid>
		<description><![CDATA[I was trying to set up a WCF net-tcp service on a test environment, but kept getting an error saying the certificate could not be found. The problem was down to a slight difference between the test certificates we were using locally, and the certificate we were given for the test environment. We&#8217;re using FindBySubjectDistinguishedName [...]]]></description>
			<content:encoded><![CDATA[<p>I was trying to set up a WCF net-tcp service on a test environment, but kept getting an error saying the certificate could not be found. The problem was down to a slight difference between the test certificates we were using locally, and the certificate we were given for the test environment. We&#8217;re using FindBySubjectDistinguishedName in the config.</p>
<p>The test certificate&#8217;s subject looked like this:</p>
<p><code>CN = TestCertName</code></p>
<p>Whereas the environment certificate&#8217;s subject looked like:</p>
<p><code>CN = CertName<br />
OU = Company Ltd.<br />
O = Company<br />
L = Town<br />
S = County<br />
C = Country Code</code></p>
<p>All the examples I&#8217;ve seen just cover certificates with the <code>CN</code> part. This is straightforward to reference in the WCF config:</p>
<pre class="brush: xml; light: true; title: ;">
&lt;serviceCredentials&gt;
   &lt;serviceCertificate
            storeLocation=&quot;LocalMachine&quot;
            storeName=&quot;My&quot;
            findValue=&quot;CN=TestCertName&quot;
            x509FindType=&quot;FindBySubjectDistinguishedName&quot; /&gt;
&lt;/serviceCredentials&gt;
</pre>
<p>However, when the certificate subject has multiple parts (i.e. more than just <code>CN</code>), you need to put all of them in the <code>findValue</code> attribute. But how to separate them? I tried several characters &#8211; space, comma, semicolon, colon &#8211; none worked. The certificate could not be found! Finally I noticed that in the top part of the certificate&#8217;s properties window, the values are separated by a comma <em>and</em> a space. Unbelievably, this also applies to the config! How intuitive. So for the &#8220;CertName&#8221; certificate above, here&#8217;s how to reference it in the WCF config:</p>
<pre class="brush: xml; light: true; title: ;">
&lt;serviceCredentials&gt;
   &lt;serviceCertificate
            storeLocation=&quot;LocalMachine&quot;
            storeName=&quot;My&quot;
            findValue=&quot;CN=TestCertName, OU=Company Ltd., O=Company, L=Town, S=County, C=Country Code&quot;
            x509FindType=&quot;FindBySubjectDistinguishedName&quot; /&gt;
&lt;/serviceCredentials&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.reveille.org.uk/2010/01/wcf-configuration-certificates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

