List of usage examples for io.netty.handler.ssl OpenSsl supportsKeyManagerFactory
public static boolean supportsKeyManagerFactory()
From source file:org.apache.qpid.jms.integration.SslIntegrationTest.java
License:Apache License
@Test(timeout = 20000) public void testCreateAndCloseSslConnectionOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());// w w w . j a v a2 s .c om assumeTrue(OpenSsl.supportsKeyManagerFactory()); testCreateAndCloseSslConnection(true); }
From source file:org.apache.qpid.jms.integration.SslIntegrationTest.java
License:Apache License
@Test(timeout = 20000) public void testCreateSslConnectionWithServerSendingPreemptiveDataOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());//from w w w .j a v a 2 s . co m assumeTrue(OpenSsl.supportsKeyManagerFactory()); doTestCreateSslConnectionWithServerSendingPreemptiveData(true); }
From source file:org.apache.qpid.jms.integration.SslIntegrationTest.java
License:Apache License
@Test(timeout = 20000) public void testCreateAndCloseSslConnectionWithClientAuthOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());//from www .j a va 2 s . c om assumeTrue(OpenSsl.supportsKeyManagerFactory()); doTestCreateAndCloseSslConnectionWithClientAuth(true); }
From source file:org.apache.qpid.jms.integration.SslIntegrationTest.java
License:Apache License
@Test(timeout = 20000) public void testCreateAndCloseSslConnectionWithAliasOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());/*from www . j a v a 2 s. c o m*/ assumeTrue(OpenSsl.supportsKeyManagerFactory()); doConnectionWithAliasTestImpl(CLIENT_KEY_ALIAS, CLIENT_DN, true); doConnectionWithAliasTestImpl(CLIENT2_KEY_ALIAS, CLIENT2_DN, true); }
From source file:org.apache.qpid.jms.transports.netty.NettyOpenSslTransportTest.java
License:Apache License
private void doTestOpenSSLSupport(boolean useOpenSSL) throws Exception { assumeTrue(OpenSsl.isAvailable());//from ww w .j av a2 s. co m assumeTrue(OpenSsl.supportsKeyManagerFactory()); try (NettyEchoServer server = createEchoServer(createServerOptions())) { server.start(); int port = server.getServerPort(); URI serverLocation = new URI("tcp://localhost:" + port); TransportOptions options = createClientOptions(); options.setUseOpenSSL(useOpenSSL); Transport transport = createTransport(serverLocation, testListener, options); try { transport.connect(null, null); LOG.info("Connected to server:{} as expected.", serverLocation); } catch (Exception e) { fail("Should have connected to the server at " + serverLocation + " but got exception: " + e); } assertTrue(transport.isConnected()); assertEquals(serverLocation, transport.getRemoteLocation()); assertOpenSSL("Transport should be using OpenSSL", useOpenSSL, transport); transport.close(); // Additional close should not fail or cause other problems. transport.close(); } assertTrue(!transportClosed); // Normal shutdown does not trigger the event. assertTrue(exceptions.isEmpty()); assertTrue(data.isEmpty()); }
From source file:org.apache.qpid.jms.transports.netty.NettyOpenSslTransportTest.java
License:Apache License
@Test(timeout = 60 * 1000) public void testConnectToServerWithUserSuppliedSSLContextWorksWhenOpenSSLRequested() throws Exception { assumeTrue(OpenSsl.isAvailable());//from w w w. j av a2 s.c o m assumeTrue(OpenSsl.supportsKeyManagerFactory()); try (NettyEchoServer server = createEchoServer(createServerOptions())) { server.start(); int port = server.getServerPort(); URI serverLocation = new URI("tcp://localhost:" + port); TransportOptions options = new TransportOptions(); options.setKeyStoreLocation(CLIENT_KEYSTORE); options.setKeyStorePassword(PASSWORD); options.setTrustStoreLocation(CLIENT_TRUSTSTORE); options.setTrustStorePassword(PASSWORD); options.setStoreType(KEYSTORE_TYPE); SSLContext sslContext = TransportSupport.createJdkSslContext(options); options = new TransportOptions(); options.setVerifyHost(false); options.setUseOpenSSL(true); Transport transport = createTransport(serverLocation, testListener, options); try { transport.connect(null, sslContext); LOG.info("Connected to server:{} as expected.", serverLocation); } catch (Exception e) { fail("Should have connected to the server at " + serverLocation + " but got exception: " + e); } assertTrue(transport.isConnected()); assertEquals(serverLocation, transport.getRemoteLocation()); assertOpenSSL("Transport should not be using OpenSSL", false, transport); transport.close(); // Additional close should not fail or cause other problems. transport.close(); } assertTrue(!transportClosed); // Normal shutdown does not trigger the event. assertTrue(exceptions.isEmpty()); assertTrue(data.isEmpty()); }
From source file:org.apache.qpid.jms.transports.TransportSupportTest.java
License:Apache License
@Test public void testLegacySslProtocolsDisabledByDefaultOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());//from w ww .j ava 2 s . c o m assumeTrue(OpenSsl.supportsKeyManagerFactory()); TransportOptions options = createJksSslOptions(null); SslContext context = TransportSupport.createOpenSslContext(options); assertNotNull(context); SSLEngine engine = TransportSupport.createOpenSslEngine(PooledByteBufAllocator.DEFAULT, null, context, options); assertNotNull(engine); List<String> engineProtocols = Arrays.asList(engine.getEnabledProtocols()); assertFalse("SSLv3 should not be enabled by default", engineProtocols.contains("SSLv3")); // TODO - Netty is currently unable to disable OpenSSL SSLv2Hello so we are stuck with it for now. // assertFalse("SSLv2Hello should not be enabled by default", engineProtocols.contains("SSLv2Hello")); }
From source file:org.apache.qpid.jms.transports.TransportSupportTest.java
License:Apache License
@Test public void testCreateSslContextJksStoreOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());/*from ww w. j a v a2s .c o m*/ assumeTrue(OpenSsl.supportsKeyManagerFactory()); TransportOptions options = createJksSslOptions(); SslContext context = TransportSupport.createOpenSslContext(options); assertNotNull(context); // TODO There is no means currently of getting the protocol from the netty SslContext. // assertEquals("TLS", context.getProtocol()); }
From source file:org.apache.qpid.jms.transports.TransportSupportTest.java
License:Apache License
@Test public void testCreateSslContextJksStoreWithConfiguredContextProtocolOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());// ww w. j ava2s. co m assumeTrue(OpenSsl.supportsKeyManagerFactory()); TransportOptions options = createJksSslOptions(); String contextProtocol = "TLSv1.2"; options.setContextProtocol(contextProtocol); SslContext context = TransportSupport.createOpenSslContext(options); assertNotNull(context); // TODO There is no means currently of getting the protocol from the netty SslContext. // assertEquals(contextProtocol, context.getProtocol()); }
From source file:org.apache.qpid.jms.transports.TransportSupportTest.java
License:Apache License
@Test(expected = UnrecoverableKeyException.class) public void testCreateSslContextNoKeyStorePasswordOpenSSL() throws Exception { assumeTrue(OpenSsl.isAvailable());//from ww w . j av a 2 s . c om assumeTrue(OpenSsl.supportsKeyManagerFactory()); TransportOptions options = createJksSslOptions(); options.setKeyStorePassword(null); TransportSupport.createOpenSslContext(options); }