Example usage for io.netty.handler.ssl SslContext cipherSuites

List of usage examples for io.netty.handler.ssl SslContext cipherSuites

Introduction

In this page you can find the example usage for io.netty.handler.ssl SslContext cipherSuites.

Prototype

public abstract List<String> cipherSuites();

Source Link

Document

Returns the list of enabled cipher suites, in the order of preference.

Usage

From source file:io.crate.protocols.ssl.SslConfigurationTest.java

@Test
public void testSslContextCreation() {
    Settings settings = Settings.builder()
            .put(SslConfigSettings.SSL_TRUSTSTORE_FILEPATH_SETTING_NAME, trustStoreFile.getAbsolutePath())
            .put(SslConfigSettings.SSL_TRUSTSTORE_PASSWORD_SETTING_NAME, TRUSTSTORE_PASSWORD)
            .put(SslConfigSettings.SSL_KEYSTORE_FILEPATH_SETTING_NAME, keyStoreFile.getAbsolutePath())
            .put(SslConfigSettings.SSL_KEYSTORE_PASSWORD_SETTING_NAME, KEYSTORE_PASSWORD)
            .put(SslConfigSettings.SSL_KEYSTORE_KEY_PASSWORD_SETTING_NAME, KEYSTORE_KEY_PASSWORD).build();
    SslContext sslContext = SslConfiguration.buildSslContext(settings);
    assertThat(sslContext.isServer(), is(true));
    assertThat(sslContext.cipherSuites(), not(empty()));
    // check that we don't offer NULL ciphers which do not encrypt
    assertThat(sslContext.cipherSuites(), not(hasItem(containsString("NULL"))));
}

From source file:io.vertx.core.net.SSLHelperTest.java

License:Open Source License

@Test
public void testUseJdkCiphersWhenNotSpecified() throws Exception {
    SSLContext context = SSLContext.getInstance("TLS");
    context.init(null, null, null);/* www  .  j  av  a2 s  . com*/
    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()));
}

From source file:io.vertx.core.net.SSLHelperTest.java

License:Open Source License

@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());//from  ww w  .j a  va  2 s. c  o m
    SslContext ctx = helper.getContext((VertxInternal) vertx);
    assertEquals(expected, new HashSet<>(ctx.cipherSuites()));
}

From source file:io.vertx.test.core.SSLHelperTest.java

License:Open Source License

@Test
public void testUseOpenSSLCiphersWhenNotSpecified() throws Exception {
    Set<String> expected = OpenSsl.availableCipherSuites();
    SSLHelper helper = new SSLHelper(
            new HttpClientOptions().setOpenSslEngineOptions(new OpenSSLEngineOptions()), Cert.CLIENT_PEM.get(),
            Trust.SERVER_PEM.get());/*from w w w.  ja va2s . co  m*/
    SslContext ctx = helper.getContext((VertxInternal) vertx);
    assertEquals(expected, new HashSet<>(ctx.cipherSuites()));
}