KeyStoreLocator { public KeyStore createKeyStore(String idpEntityId, String idpCertificate, String spEntityId, String spCertificate, String spPrivateKey, String pemPassPhrase) { try { KeyStore keyStore = KeyStore.getInstance("JKS"); keyStore.load(null, pemPassPhrase.toCharArray()); addCertificate(keyStore, idpEntityId, idpCertificate); addPrivateKey(keyStore, spEntityId, spPrivateKey, spCertificate, pemPassPhrase); return keyStore; } catch (Exception e) { throw new RuntimeException(e); } }  KeyStore createKeyStore(String idpEntityId,
                                 String idpCertificate,
                                 String spEntityId,
                                 String spCertificate,
                                 //This must be in the DER unencrypted PKCS#8 format. See README.md
                                 String spPrivateKey,
                                 String pemPassPhrase);  }
@Test public void testCreateKeyStore() throws Exception { JKSKeyManager jksKeyManager = createJksKeyManager(); Credential defaultCredential = jksKeyManager.getDefaultCredential(); assertEquals("RSA", defaultCredential.getPrivateKey().getAlgorithm()); assertEquals("RSA", defaultCredential.getPublicKey().getAlgorithm()); X509Certificate certificate = jksKeyManager.getCertificate(properties.getProperty("idp.entity.id")); String name = certificate.getSubjectDN().getName(); assertEquals("O=Internet Widgits Pty Ltd, ST=Some-State, C=AU", name); }