title: Invoking Java web service from C# client using JKS and/or PFX certificates
body: <p>I basically need to secure my requests towards this service.</p>
  
  <p>I've been provided a <code>JAR</code> test client and two files, <code>trust.jks</code> and <code>Client.pfx</code>, but I have no clue how to use them: I understand X509Certificate2 class is involved in some way.</p>
  
  <p>The command line to execute the test client is the following:</p>
  
  <pre><code>java -Djavax.net.ssl.trustStore=trust.jks -Djavax.net.ssl.trustStorePassword=******** -Djavax.net.ssl.trustStoreType=JKS -Djavax.net.ssl.keyStore=Client.pfx -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStorePassword=******** -jar TestClient.jar https://myServiceurl
  </code></pre>
  
  <p>It works, so I can both see the service, and the service itself should be properly configured.</p>
  
  <p>My C# client (it's targeting .NET 2.0) uses a normal Web Reference to perform requests:</p>
  
  <pre><code>wsReferenceClient service = new wsReferenceClient();
  //certificate code here ?
  //maybe service.ClientCertificates.Add(&lt;X509Certificate2 object built somehow&gt;); ?
  service.MyRequest(myParameters);
  </code></pre>
  
  <p>Server settings should be setup properly.</p>
  
  <p>I fumbled around with the <code>X509Certificate2</code> methods but I can't come out with something that makes sense, so the answer to the 'what have you tried?' question at the moment is 'I don't really know what to try in the first place'.</p>
  
  <p>Any help would be really appreciated.</p>