title: How to add a certificate chain to a JKS
body: <p>I have a certificate chain called: <code>cert.cer</code> with the content of: </p>
  
  <pre><code>subject= ... OU=MyCA
  issuer= ... OU=MyCA
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----
  
  subject= ... OU=Client
  issuer= .. OU=MyCA
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----
  </code></pre>
  
  <hr>
  
  <p>I tried to add this chain to JKS by calling:</p>
  
  <p><code>keytool -import -trustcacerts -file cert.cer -keystore sample.keystore -storepass 123456 -alias chain</code></p>
  
  <p>, which only adds the top level certificate of OU=MyCA.</p>
  
  <p>How do I add this chain correctly to the JavaKeyStore (JKS)?</p>