@Test public void testCreateSslContextJksStoreJDK() throws Exception { TransportOptions options = createJksSslOptions(); SSLContext context = TransportSupport.createJdkSslContext(options); assertNotNull(context); assertEquals("TLS", context.getProtocol()); }
public static SSLContext createJdkSslContext(TransportOptions options) throws Exception { try { String contextProtocol = options.getContextProtocol(); LOG.trace("Getting SSLContext instance using protocol: {}", contextProtocol); SSLContext context = SSLContext.getInstance(contextProtocol); KeyManager[] keyMgrs = loadKeyManagers(options); TrustManager[] trustManagers = loadTrustManagers(options); context.init(keyMgrs, trustManagers, new SecureRandom()); return context; } catch (Exception e) { LOG.error("Failed to create SSLContext: {}", e, e); throw e; } }
TransportSupport { public static SSLContext createJdkSslContext(TransportOptions options) throws Exception { try { String contextProtocol = options.getContextProtocol(); LOG.trace("Getting SSLContext instance using protocol: {}", contextProtocol); SSLContext context = SSLContext.getInstance(contextProtocol); KeyManager[] keyMgrs = loadKeyManagers(options); TrustManager[] trustManagers = loadTrustManagers(options); context.init(keyMgrs, trustManagers, new SecureRandom()); return context; } catch (Exception e) { LOG.error("Failed to create SSLContext: {}", e, e); throw e; } } }
TransportSupport { public static SSLContext createJdkSslContext(TransportOptions options) throws Exception { try { String contextProtocol = options.getContextProtocol(); LOG.trace("Getting SSLContext instance using protocol: {}", contextProtocol); SSLContext context = SSLContext.getInstance(contextProtocol); KeyManager[] keyMgrs = loadKeyManagers(options); TrustManager[] trustManagers = loadTrustManagers(options); context.init(keyMgrs, trustManagers, new SecureRandom()); return context; } catch (Exception e) { LOG.error("Failed to create SSLContext: {}", e, e); throw e; } }  }
TransportSupport { public static SSLContext createJdkSslContext(TransportOptions options) throws Exception { try { String contextProtocol = options.getContextProtocol(); LOG.trace("Getting SSLContext instance using protocol: {}", contextProtocol); SSLContext context = SSLContext.getInstance(contextProtocol); KeyManager[] keyMgrs = loadKeyManagers(options); TrustManager[] trustManagers = loadTrustManagers(options); context.init(keyMgrs, trustManagers, new SecureRandom()); return context; } catch (Exception e) { LOG.error("Failed to create SSLContext: {}", e, e); throw e; } }  static boolean isOpenSSLPossible(TransportOptions options); static SslHandler createSslHandler(ByteBufAllocator allocator, URI remote, TransportOptions options); static SSLContext createJdkSslContext(TransportOptions options); static SSLEngine createJdkSslEngine(URI remote, SSLContext context, TransportOptions options); static SslContext createOpenSslContext(TransportOptions options); static SSLEngine createOpenSslEngine(ByteBufAllocator allocator, URI remote, SslContext context, TransportOptions options); }
TransportSupport { public static SSLContext createJdkSslContext(TransportOptions options) throws Exception { try { String contextProtocol = options.getContextProtocol(); LOG.trace("Getting SSLContext instance using protocol: {}", contextProtocol); SSLContext context = SSLContext.getInstance(contextProtocol); KeyManager[] keyMgrs = loadKeyManagers(options); TrustManager[] trustManagers = loadTrustManagers(options); context.init(keyMgrs, trustManagers, new SecureRandom()); return context; } catch (Exception e) { LOG.error("Failed to create SSLContext: {}", e, e); throw e; } }  static boolean isOpenSSLPossible(TransportOptions options); static SslHandler createSslHandler(ByteBufAllocator allocator, URI remote, TransportOptions options); static SSLContext createJdkSslContext(TransportOptions options); static SSLEngine createJdkSslEngine(URI remote, SSLContext context, TransportOptions options); static SslContext createOpenSslContext(TransportOptions options); static SSLEngine createOpenSslEngine(ByteBufAllocator allocator, URI remote, SslContext context, TransportOptions options);  }