@Test public void testLoadFile() throws Exception { FSKeystoreProvider provider = new FSKeystoreProvider(KS_PATH, KS_PASS, KS_TYPE); KeyStore ks = provider.getKeyStore(); assertEquals("kangaroo", ks.aliases().nextElement()); Certificate[] chain = ks.getCertificateChain("kangaroo"); assertEquals(1, chain.length); X509Certificate cert = (X509Certificate) chain[0]; assertNotNull(cert); Principal iss = cert.getIssuerDN(); Principal sub = cert.getSubjectDN(); assertEquals("EMAILADDRESS=krotscheck@gmail.com, " + "CN=localhost, OU=Kangaroo, O=Kangaroo, L=Seattle, " + "ST=Washington, C=US", iss.getName()); assertEquals("EMAILADDRESS=krotscheck@gmail.com, " + "CN=localhost, OU=Kangaroo, O=Kangaroo, L=Seattle, " + "ST=Washington, C=US", sub.getName()); }
public KeyStore getKeyStore() { if (keyStore == null) { try { keyStore = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystorePath); keyStore.load(fis, keystorePass.toCharArray()); } catch (Exception e) { throw new RuntimeException(e); } } return keyStore; }
FSKeystoreProvider implements IKeystoreProvider { public KeyStore getKeyStore() { if (keyStore == null) { try { keyStore = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystorePath); keyStore.load(fis, keystorePass.toCharArray()); } catch (Exception e) { throw new RuntimeException(e); } } return keyStore; } }
FSKeystoreProvider implements IKeystoreProvider { public KeyStore getKeyStore() { if (keyStore == null) { try { keyStore = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystorePath); keyStore.load(fis, keystorePass.toCharArray()); } catch (Exception e) { throw new RuntimeException(e); } } return keyStore; } FSKeystoreProvider(final String keystorePath,
                              final String keystorePass,
                              final String keystoreType); }
FSKeystoreProvider implements IKeystoreProvider { public KeyStore getKeyStore() { if (keyStore == null) { try { keyStore = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystorePath); keyStore.load(fis, keystorePass.toCharArray()); } catch (Exception e) { throw new RuntimeException(e); } } return keyStore; } FSKeystoreProvider(final String keystorePath,
                              final String keystorePass,
                              final String keystoreType); KeyStore getKeyStore(); @Override void writeTo(final OutputStream outputStream); }
FSKeystoreProvider implements IKeystoreProvider { public KeyStore getKeyStore() { if (keyStore == null) { try { keyStore = KeyStore.getInstance(keystoreType); FileInputStream fis = new FileInputStream(keystorePath); keyStore.load(fis, keystorePass.toCharArray()); } catch (Exception e) { throw new RuntimeException(e); } } return keyStore; } FSKeystoreProvider(final String keystorePath,
                              final String keystorePass,
                              final String keystoreType); KeyStore getKeyStore(); @Override void writeTo(final OutputStream outputStream);  }