@Test public void testPreserveEnabledCipherSuitesOrder() throws Exception { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, null, null); SSLEngine engine = context.createSSLEngine(); HttpServerOptions options = new HttpServerOptions(); for (String suite : engine.getEnabledCipherSuites()) { options.addEnabledCipherSuite(suite); } assertEquals(new ArrayList<>(options.getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); assertEquals(new ArrayList<>(new HttpServerOptions(options).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); JsonObject json = options.toJson(); assertEquals(new ArrayList<>(new HttpServerOptions(json).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); SSLHelper helper = new SSLHelper(options, Cert.SERVER_JKS.get(), null); assertEquals(Arrays.asList(helper.createEngine((VertxInternal) vertx).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); }
static HttpServerOptions createHttp2ServerOptions(int port, String host) { return new HttpServerOptions() .setPort(port) .setHost(host) .setUseAlpn(true) .setSsl(true) .addEnabledCipherSuite("TLS_RSA_WITH_AES_128_CBC_SHA") // Non Diffie-helman -> debuggable in wireshark .setKeyStoreOptions(Cert.SERVER_JKS.get()); };
.setUseAlpn(true) .setSsl(true) .addEnabledCipherSuite("TLS_RSA_WITH_AES_128_CBC_SHA") // Non Diffie-helman -> debuggable in wireshark .setPemKeyCertOptions(Cert.SERVER_PEM.get()).setSslEngineOptions(new OpenSSLEngineOptions()); server.close();
options.setKeyCertOptions(keyCertOptions); options.setTrustOptions(trustOptions); options.addEnabledCipherSuite(enabledCipher); options.addCrlPath(crlPath); options.addCrlValue(crlValue);
serverOptions.addEnabledCipherSuite(suite);
serverOptions.setSni(serverSNI); for (String suite: serverEnabledCipherSuites) { serverOptions.addEnabledCipherSuite(suite);
@Override public HttpTermOptions addEnabledCipherSuite(String suite) { return (HttpTermOptions) super.addEnabledCipherSuite(suite); }
@Test public void testPreserveEnabledCipherSuitesOrder() throws Exception { SSLContext context = SSLContext.getInstance("TLS"); context.init(null, null, null); SSLEngine engine = context.createSSLEngine(); HttpServerOptions options = new HttpServerOptions(); for (String suite : engine.getEnabledCipherSuites()) { options.addEnabledCipherSuite(suite); } assertEquals(new ArrayList<>(options.getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); assertEquals(new ArrayList<>(new HttpServerOptions(options).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); JsonObject json = options.toJson(); assertEquals(new ArrayList<>(new HttpServerOptions(json).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); SSLHelper helper = new SSLHelper(options, Cert.SERVER_JKS.get(), null); assertEquals(Arrays.asList(helper.createEngine((VertxInternal) vertx).getEnabledCipherSuites()), Arrays.asList(engine.getEnabledCipherSuites())); }
assertEquals(options, options.addEnabledCipherSuite("foo")); assertEquals(options, options.addEnabledCipherSuite("bar")); assertNotNull(options.getEnabledCipherSuites()); assertTrue(options.getEnabledCipherSuites().contains("foo"));
static HttpServerOptions createHttp2ServerOptions(int port, String host) { return new HttpServerOptions() .setPort(port) .setHost(host) .setUseAlpn(true) .setSsl(true) .addEnabledCipherSuite("TLS_RSA_WITH_AES_128_CBC_SHA") // Non Diffie-helman -> debuggable in wireshark .setKeyStoreOptions(Cert.SERVER_JKS.get()); };
.setUseAlpn(true) .setSsl(true) .addEnabledCipherSuite("TLS_RSA_WITH_AES_128_CBC_SHA") // Non Diffie-helman -> debuggable in wireshark .setPemKeyCertOptions(Cert.SERVER_PEM.get()).setSslEngineOptions(new OpenSSLEngineOptions()); server.close();
options.setKeyCertOptions(keyCertOptions); options.setTrustOptions(trustOptions); options.addEnabledCipherSuite(enabledCipher); options.addCrlPath(crlPath); options.addCrlValue(crlValue);
serverOptions.addEnabledCipherSuite(suite);
serverOptions.setSni(serverSNI); for (String suite: serverEnabledCipherSuites) { serverOptions.addEnabledCipherSuite(suite);
assertEquals(options, options.addEnabledCipherSuite("foo")); assertEquals(options, options.addEnabledCipherSuite("bar")); assertNotNull(options.getEnabledCipherSuites()); assertTrue(options.getEnabledCipherSuites().contains("foo"));