title: Java PKCS12 keystore - Unrecognized keystore format
body: <p>I'm trying to create a PKCS12 keystore using Bouncy Castle Crypto in Java8 and it creates all good.  Now, if I try to load the generated keystore using keytool, it is not able to recognise the format automatically.</p>
  <p>i.e. this command fails with below error</p>
  <p><code>keytool -v -list -keystore my_store.p12</code></p>
  <pre><code>java.security.KeyStoreException: Unrecognized keystore format. Please load it with a specified type
          at java.base/java.security.KeyStore.getInstance(KeyStore.java:1816)
          at java.base/java.security.KeyStore.getInstance(KeyStore.java:1687)
          at java.base/sun.security.tools.keytool.Main.doCommands(Main.java:928)
          at java.base/sun.security.tools.keytool.Main.run(Main.java:412)
          at java.base/sun.security.tools.keytool.Main.main(Main.java:405)
  </code></pre>
  <p>It is indeed able to load the keystore and display everything just fine if i add the format like below.</p>
  <p><code>keytool -v -list -keystore my_store.p12 -storetype PKCS12</code></p>
  <p>Also, it works just fine if I run it using the JDK I used to compile.  I created a wrapper to the JDK's keytool in a class like below and that works.</p>
  <pre><code>public static void main(String[] args) throws Exception {
          sun.security.tools.keytool.Main.main(args);
      }
  </code></pre>
  <p>Why is the standalone keytool unable to recognise the format?  How to make the format visible for all keytools to work?</p>