title: JKS instance in java able to load pkcs12 keystore
body: <p>Good day everyone. I have a code in my application as given where I am generating private key and cerificate as below.</p>
  <pre><code> ClassPathResource storeFile = new ClassPathResource(SAML_KEYSTORE_PATH);
        KeyStore keystore = KeyStore.getInstance(&quot;jks&quot;);
        keystore.load(storeFile.getInputStream(), SAML_KEYSTORE_PASS.toCharArray());
        PrivateKey spPrivateKey = (PrivateKey) keystore.getKey(SAML_PRIVATE_KEY_ALIAS,
            SAML_PRIVATE_KEY_PASS.toCharArray());
        X509Certificate spPublicCert =
            (X509Certificate) keystore.getCertificate(SAML_PRIVATE_KEY_ALIAS);
  </code></pre>
  <p>SAML_KEYSTORE_PATH has the path to /saml/samlKeystore.jks file which is not JKS it is generated using the -storetype PKCS12 using keytool. It is just the extension is .jks format. I am not sure how this is working, why I am able to generate those key and cerificate from pkcs12 keystore format and using jks instance in java/kotlin. Can someone please shed some light how this is working ? Thanks a lot.</p>