Search in sources :

Example 11 with TlsConfiguration

use of org.mule.runtime.core.privileged.security.tls.TlsConfiguration in project mule by mulesoft.

the class TlsConfigurationTestCase method testSimpleSocket.

@Test
public void testSimpleSocket() throws Exception {
    TlsConfiguration configuration = new TlsConfiguration(DEFAULT_KEYSTORE);
    configuration.setKeyPassword("mulepassword");
    configuration.setKeyStorePassword("mulepassword");
    configuration.setKeyStore("clientKeystore");
    configuration.initialise(false, JSSE_NAMESPACE);
    SSLSocketFactory socketFactory = configuration.getSocketFactory();
    assertTrue("socket is useless", socketFactory.getSupportedCipherSuites().length > 0);
}
Also used : TlsConfiguration(org.mule.runtime.core.privileged.security.tls.TlsConfiguration) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) Test(org.junit.Test)

Example 12 with TlsConfiguration

use of org.mule.runtime.core.privileged.security.tls.TlsConfiguration in project mule by mulesoft.

the class TlsConfigurationTestCase method defaultProtocol.

@Test
public void defaultProtocol() throws Exception {
    TlsConfiguration tlsConfiguration = new TlsConfiguration(DEFAULT_KEYSTORE);
    tlsConfiguration.initialise(true, JSSE_NAMESPACE);
    SSLSocketFactory socketFactory = tlsConfiguration.getSocketFactory();
    SSLServerSocketFactory serverSocketFactory = tlsConfiguration.getServerSocketFactory();
    SSLContext sslContext = SSLContext.getInstance(DEFAULT_SSL_TYPE);
    sslContext.init(null, null, null);
    assertThat(socketFactory.getDefaultCipherSuites(), arrayContainingInAnyOrder(sslContext.getSocketFactory().getDefaultCipherSuites()));
}
Also used : SSLServerSocketFactory(javax.net.ssl.SSLServerSocketFactory) TlsConfiguration(org.mule.runtime.core.privileged.security.tls.TlsConfiguration) SSLContext(javax.net.ssl.SSLContext) SSLSocketFactory(javax.net.ssl.SSLSocketFactory) Test(org.junit.Test)

Aggregations

TlsConfiguration (org.mule.runtime.core.privileged.security.tls.TlsConfiguration)12 Test (org.junit.Test)10 File (java.io.File)6 SSLSocketFactory (javax.net.ssl.SSLSocketFactory)4 IOException (java.io.IOException)3 SSLContext (javax.net.ssl.SSLContext)3 SSLServerSocket (javax.net.ssl.SSLServerSocket)2 SSLServerSocketFactory (javax.net.ssl.SSLServerSocketFactory)2 SSLSocket (javax.net.ssl.SSLSocket)2 CreateException (org.mule.runtime.api.lifecycle.CreateException)2 URL (java.net.URL)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 TlsPropertiesSocketFactory (org.mule.runtime.core.internal.secutiry.tls.TlsPropertiesSocketFactory)1