public synchronized void validate(VertxInternal vertx) { if (ssl) { getContext(vertx, null); } }
public Mapping<? super String, ? extends SslContext> serverNameMapper(VertxInternal vertx) { return serverName -> { SslContext ctx = getContext(vertx, serverName); if (ctx != null) { ctx = new DelegatingSslContext(ctx) { @Override protected void initEngine(SSLEngine engine) { configureEngine(engine, serverName); } }; } return ctx; }; }
public SslContext getContext(VertxInternal vertx) { return getContext(vertx, null); }
public SSLEngine createEngine(VertxInternal vertx, String host, int port, boolean forceSNI) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT, host, port); configureEngine(engine, forceSNI ? host : null); return engine; }
public SSLEngine createEngine(VertxInternal vertx, String host, int port) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT, host, port); configureEngine(engine, null); return engine; }
public SSLEngine createEngine(VertxInternal vertx) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT); configureEngine(engine, null); return engine; } }
public SSLEngine createEngine(VertxInternal vertx, SocketAddress socketAddress, String serverName) { SslContext context = getContext(vertx, null); SSLEngine engine; if (socketAddress.path() != null) { engine = context.newEngine(ByteBufAllocator.DEFAULT); } else { engine = context.newEngine(ByteBufAllocator.DEFAULT, socketAddress.host(), socketAddress.port()); } configureEngine(engine, serverName); return engine; }
@Test public void testUseJdkCiphersWhenNotSpecified() throws Exception { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, null, null); SSLEngine engine = context.createSSLEngine(); String[] expected = engine.getEnabledCipherSuites(); SSLHelper helper = new SSLHelper(new HttpClientOptions(), Cert.CLIENT_JKS.get(), Trust.SERVER_JKS.get()); SslContext ctx = helper.getContext((VertxInternal) vertx); assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(ctx.cipherSuites())); }
public synchronized void validate(VertxInternal vertx) { if (ssl) { getContext(vertx, null); } }
public Mapping<? super String, ? extends SslContext> serverNameMapper(VertxInternal vertx) { return serverName -> { SslContext ctx = getContext(vertx, serverName); if (ctx != null) { ctx = new DelegatingSslContext(ctx) { @Override protected void initEngine(SSLEngine engine) { configureEngine(engine, serverName); } }; } return ctx; }; }
public SslContext getContext(VertxInternal vertx) { return getContext(vertx, null); }
@Test public void testUseOpenSSLCiphersWhenNotSpecified() throws Exception { Set<String> expected = OpenSsl.availableOpenSslCipherSuites(); SSLHelper helper = new SSLHelper( new HttpClientOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()), Cert.CLIENT_PEM.get(), Trust.SERVER_PEM.get()); SslContext ctx = helper.getContext((VertxInternal) vertx); assertEquals(expected, new HashSet<>(ctx.cipherSuites())); }
private void testOpenSslServerSessionContext(boolean testDefault){ HttpServerOptions httpServerOptions = new HttpServerOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()); if(!testDefault) { httpServerOptions.setOpenSslEngineOptions(new OpenSSLEngineOptions().setSessionCacheEnabled(false)); } SSLHelper defaultHelper = new SSLHelper(httpServerOptions, Cert.SERVER_PEM.get(), Trust.SERVER_PEM.get()); SslContext ctx = defaultHelper.getContext((VertxInternal) vertx); assertTrue(ctx instanceof OpenSslServerContext); SSLSessionContext sslSessionContext = ctx.sessionContext(); assertTrue(sslSessionContext instanceof OpenSslServerSessionContext); if (sslSessionContext instanceof OpenSslServerSessionContext) { assertEquals(testDefault, ((OpenSslServerSessionContext) sslSessionContext).isSessionCacheEnabled()); } }
public SSLEngine createEngine(VertxInternal vertx, String host, int port, boolean forceSNI) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT, host, port); configureEngine(engine, forceSNI ? host : null); return engine; }
public SSLEngine createEngine(VertxInternal vertx, String host, int port) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT, host, port); configureEngine(engine, null); return engine; }
public SSLEngine createEngine(VertxInternal vertx) { SSLEngine engine = getContext(vertx, null).newEngine(ByteBufAllocator.DEFAULT); configureEngine(engine, null); return engine; } }
HttpServerImpl impl = (HttpServerImpl) s; SSLHelper sslHelper = impl.getSslHelper(); SslContext ctx = sslHelper.getContext((VertxInternal) vertx); switch (expectedSslContext != null ? expectedSslContext : "jdk") { case "jdk":
public SSLEngine createEngine(VertxInternal vertx, SocketAddress socketAddress, String serverName) { SslContext context = getContext(vertx, null); SSLEngine engine; if (socketAddress.path() != null) { engine = context.newEngine(ByteBufAllocator.DEFAULT); } else { engine = context.newEngine(ByteBufAllocator.DEFAULT, socketAddress.host(), socketAddress.port()); } configureEngine(engine, serverName); return engine; }
@Test public void testUseJdkCiphersWhenNotSpecified() throws Exception { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, null, null); SSLEngine engine = context.createSSLEngine(); String[] expected = engine.getEnabledCipherSuites(); SSLHelper helper = new SSLHelper(new HttpClientOptions(), Cert.CLIENT_JKS.get(), Trust.SERVER_JKS.get()); SslContext ctx = helper.getContext((VertxInternal) vertx); assertEquals(new HashSet<>(Arrays.asList(expected)), new HashSet<>(ctx.cipherSuites())); }
@Test public void testUseOpenSSLCiphersWhenNotSpecified() throws Exception { Set<String> expected = OpenSsl.availableOpenSslCipherSuites(); SSLHelper helper = new SSLHelper( new HttpClientOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()), Cert.CLIENT_PEM.get(), Trust.SERVER_PEM.get()); SslContext ctx = helper.getContext((VertxInternal) vertx); assertEquals(expected, new HashSet<>(ctx.cipherSuites())); }