title: Transfer trusted certificate (plus private key / chain) from Java keystore (jks) to Windows Certificate Manager
body: <p>Some quick background on what I'm trying to do: a client is using a third party web service that requires mutual authentication. The service requires the client certificate  be signed by a public certificate authority (ie: not self-signed). The client has some software written in Java that connects to the service, hence they used Java keytool to generate the original signing request and the key/certificate are stored in a jks keystore.</p>
  
  <p>Our software that the client is going to be using is written in C#/.NET and will need to connect to the third party web service. As such we will we need to be able to access the client certificate.</p>
  
  <p>I can't seem to find any way to export the certificate (along with private key) to either the Windows Certificate Manager or some other format that can be opened by .NET security libraries.</p>
  
  <p>Exporting to a PKCS12 file does not work because keytool does not support it for trusted certificates (not sure if that is a keytool limitation or a limitation of the format).</p>
  
  <p>I also found some Java code for getting the private keys, but I can't seem to figure out how I can get that into Windows Certificate Manager and associate it with the certificate. (<a href="https://stackoverflow.com/questions/150167/how-do-i-list-export-private-keys-from-a-keystore">How do I list / export private keys from a keystore?</a>)</p>
  
  <p>As a side note, the client doesn't want to generate a new certificate as there is a whole process involved in sending it to and getting it approved by the third party service they are connecting to.</p>
  
  <p>Ultimately I'm hoping there are some commands I can run with keytool/openssl/etc that will allow the certificate &amp; key to be exported/transferred into the Windows Certificate Manager (or some format that it can import).</p>
  
  <p>(Sorry if my terminology is off or if some of this doesn't make sense. I kind of got stuck supporting this despite not being all that familiar with managing certificates.)</p>