title: How to export the all intermediate certs including root certificates using keytool only
body: <p>I am Trying to configure SSL and got the .pfx file from server team.
  The Certificate chain length: 2</p>
  
  <p>When i am trying to export the certificate chain using keytool, only the first certificate is exported. </p>
  
  <p>Trying to figure out if there is any other parameters i am missing while issuing keytool command. </p>
  
  <p>the commands I used are: </p>
  
  <p>1) converting to JKS as alias name is not supported with pfx</p>
  
  <pre><code>keytool -importkeystore -srckeystore "serverauth.pfx" -srcstoretype pkcs12 -destkeystore "serverauth.jks" 
  </code></pre>
  
  <p>2) Tried to Export certificates using the below.</p>
  
  <pre><code>keytool -export -alias 1 -keystore "serverauth.jks" -rfc -file "authclient.cert" 
  </code></pre>
  
  <p>But above command generates only first cert. </p>
  
  <p>If i remove entire alias option, getting error</p>
  
  <pre><code>keytool error: java.lang.Exception: Alias &lt;1&gt; does not exist
  </code></pre>
  
  <p>Is there any other process. </p>