public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final String crlPath) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, false, crlPath); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final boolean trustAll) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, trustAll, null); }
context = SSLContext.getDefault(); } else { context = SSLSupport.createContext(realKeyStoreProvider, realKeyStorePath, realKeyStorePassword, realTrustStoreProvider, realTrustStorePath, realTrustStorePassword, trustAll, crlPath);
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final boolean trustAll) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, trustAll, null); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final boolean trustAll) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, trustAll, null); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final String crlPath) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, false, crlPath); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final String crlPath) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, false, crlPath); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final String crlPath) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, false, crlPath); }
public static SSLContext createContext(final String keystoreProvider, final String keystorePath, final String keystorePassword, final String trustStoreProvider, final String trustStorePath, final String trustStorePassword, final boolean trustAll) throws Exception { return SSLSupport.createContext(keystoreProvider, keystorePath, keystorePassword, trustStoreProvider, trustStorePath, trustStorePassword, trustAll, null); }
@Test public void testContextWithNullParameters() throws Exception { new SSLSupport().createContext(); }
private void setupSsl() throws Exception { SSLContext context = new SSLSupport() .setKeystoreProvider(keyStoreProvider) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(trustStoreProvider) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); SSLServerSocketFactory sssf = context.getServerSocketFactory(); RMIServerSocketFactory rssf = new ArtemisSslRMIServerSocketFactory(sssf, this.isClientAuth(), rmiServerHost); RMIClientSocketFactory rcsf = new SslRMIClientSocketFactory(); environment.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, rssf); environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rcsf); }
@Test public void testContextWithKeyStorePathAsFile() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource(keyStorePath); File file = new File(url.toURI()); new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(file.getAbsolutePath()) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); }
@Test public void testContextWithKeyStorePathAsURL() throws Exception { URL url = Thread.currentThread().getContextClassLoader().getResource(keyStorePath); new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(url.toString()) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); }
public String[] getEnabledCipherSuites() throws Exception { SSLContext context = new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(SERVER_SIDE_KEYSTORE) .setKeystorePassword(PASSWORD) .setTruststoreProvider(storeType) .setTruststorePath(CLIENT_SIDE_TRUSTSTORE) .setTruststorePassword(PASSWORD) .createContext(); SSLEngine engine = context.createSSLEngine(); return engine.getEnabledCipherSuites(); }
@Test public void testContextWithRightParameters() throws Exception { new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); }
@Test public void testContextWithBadKeyStorePath() throws Exception { try { new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath("not a keystore") .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); Assert.fail(); } catch (Exception e) { } }
@Test public void testContextWithNullKeyStorePath() throws Exception { try { new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(null) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); } catch (Exception e) { Assert.fail(); } }
@Test public void testContextWithBadKeyStorePassword() throws Exception { try { new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(keyStorePath) .setKeystorePassword("bad password") .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword(trustStorePassword) .createContext(); Assert.fail(); } catch (Exception e) { } }
@Test public void testContextWithBadTrustStorePath() throws Exception { try { new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath("not a trust store") .setTruststorePassword(trustStorePassword) .createContext(); Assert.fail(); } catch (Exception e) { } }
@Test public void testContextWithTrustAll() throws Exception { //This is using a bad password but should not fail because the trust store should be ignored with //the trustAll flag set to true new SSLSupport() .setKeystoreProvider(storeType) .setKeystorePath(keyStorePath) .setKeystorePassword(keyStorePassword) .setTruststoreProvider(storeType) .setTruststorePath(trustStorePath) .setTruststorePassword("bad passord") .setTrustAll(true) .createContext(); } }