Note that there are some explanatory texts on larger screens.

plurals
  1. POProgrammatically installing certificate revocation list C#
    primarykey
    data
    text
    <p>I am using C#/WCF. I have a web service which shall be invoked by the client. This is the service definition:</p> <pre class="lang-xml prettyprint-override"><code>&lt;service behaviorConfiguration="WCFInterface.CommonBehavior" name="WCFInterface.Content"&gt; &lt;endpoint address="" binding="ws2007HttpBinding" bindingConfiguration="wsHttpUserName" contract="ABB.fTunes.WCFInterface.IContent"&gt; &lt;identity&gt; &lt;dns value="fTunesTestServer" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt; &lt;/service&gt; </code></pre> <p>And this is the binding:</p> <pre class="lang-xml prettyprint-override"><code>&lt;ws2007HttpBinding&gt; &lt;binding name="wsHttpUserName"&gt; &lt;security mode="Message"&gt; &lt;message clientCredentialType="UserName"/&gt; &lt;/security&gt; &lt;/binding&gt; &lt;/ws2007HttpBinding&gt; </code></pre> <p>If I understand this correctly, the messages sent from server to client are encrypted with a certificate. Currently I am still working with developer certificates. I created a root certificate, a certificate revokation list and a key on the server. </p> <p>I am installing the client with Windows Installer and I have a custom install action to install the certificates. </p> <p>The following code shows how the certificates are added to the store</p> <pre><code>Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ClientCertificates.MyRoot.cer"); byte[] buffer = new byte[((int)(manifestResourceStream.Length - 1L)) + 1]; manifestResourceStream.Read(buffer, 0, (int)manifestResourceStream.Length); manifestResourceStream.Close(); var cert = new X509Certificate2(buffer); var store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadWrite); store.Add(cert); store.Close(); /* // The CRL is also needed, no idea why manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ClientCertificates.MyRoot.crl"); buffer = new byte[((int)(manifestResourceStream.Length - 1L)) + 1]; manifestResourceStream.Read(buffer, 0, (int)manifestResourceStream.Length); manifestResourceStream.Close(); cert = new X509Certificate2(buffer); store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadWrite); store.Add(cert); store.Close(); */ // This is the key manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ClientCertificates.MyTestServer.cer"); buffer = new byte[((int)(manifestResourceStream.Length - 1L)) + 1]; manifestResourceStream.Read(buffer, 0, (int)manifestResourceStream.Length); manifestResourceStream.Close(); cert = new X509Certificate2(buffer); store = new X509Store(StoreName.My, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadWrite); store.Add(cert); store.Close(); </code></pre> <p>I have now two behaviors: Installing the certificates work, but when I call the web service I get a <code>SecurityNegotiationException</code>. When I add the Certificate Revocation List manually, the communication with the server works. When I try to do it programmatically (see code above) it does not work. I get a "Could not find requested object" exception. </p> <p>I tried to use different stores but with no success. </p> <p>I have two questions: a) Why do I need the CRL on the client? b) If I need it, how can I install it programmatically? Where is my mistake above?</p> <p>Thanks for your help, Kay</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload