title: Import PFX file into Existing JKS file (NOT converting from .pfx to .jks)
body: <p>I have Java web service and have implemented X.509 using jks files created by Java Keytool. </p>
  
  <pre><code>keytool -genkey -keyalg RSA -sigalg SHA1withRSA -validity 730 -alias myservicekey -keypass skpass -storepass sspass -keystore serviceKeystore.jks -dname "cn=localhost"
  
  keytool -genkey -keyalg RSA -sigalg SHA1withRSA -validity 730 -alias myclientkey  -keypass ckpass -storepass cspass -keystore clientKeystore.jks -dname "cn=clientuser"
  </code></pre>
  
  <p>To establish trust between client and server I import the server certs to client and client certs to server.</p>
  
  <p><strong>Import server public key (certs) to client.</strong></p>
  
  <pre><code>keytool -export -rfc -keystore clientKeystore.jks -storepass cspass -alias myclientkey -file MyClient.cer
  keytool -import -trustcacerts -keystore serviceKeystore.jks -storepass sspass -alias myclientkey -file MyClient.cer -noprompt
  </code></pre>
  
  <p><strong>Import client public key(certs) to server</strong></p>
  
  <pre><code>keytool -export -rfc -keystore serviceKeystore.jks -storepass sspass -alias myservicekey -file MyService.cer
  keytool -import -trustcacerts -keystore clientKeystore.jks -storepass cspass -alias myservicekey -file MyService.cer -noprompt
  </code></pre>
  
  <p>Both Service and Client are written in Java and are working fine. Now I have a .NET client and my understanding is that if I give the same jave client certificates to the .NET client i.e clientKeystore.jks it should work, but the .net client is having issues.</p>
  
  <p>The .NET client developer has insisted me to use a .pfx certificate that he generated, <strong>how can I import a .pfx certificate into an existing .jks file</strong>. </p>
  
  <p>The examples I have seen online require me to create a new .jks file. </p>
  
  <p>Thank you.</p>