Search in sources :

Example 11 with SslFilter

use of org.apache.mina.filter.ssl.SslFilter in project Openfire by igniterealtime.

the class NIOConnection method startTLS.

public void startTLS(boolean clientMode, boolean directTLS) throws Exception {
    final EncryptionArtifactFactory factory = new EncryptionArtifactFactory(configuration);
    final SslFilter filter;
    if (clientMode) {
        filter = factory.createClientModeSslFilter();
    } else {
        filter = factory.createServerModeSslFilter();
    }
    ioSession.getFilterChain().addBefore(EXECUTOR_FILTER_NAME, TLS_FILTER_NAME, filter);
    if (!directTLS) {
        ioSession.setAttribute(SslFilter.DISABLE_ENCRYPTION_ONCE, Boolean.TRUE);
    }
    if (!clientMode && !directTLS) {
        // Indicate the client that the server is ready to negotiate TLS
        deliverRawText("<proceed xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>");
    }
}
Also used : SslFilter(org.apache.mina.filter.ssl.SslFilter) EncryptionArtifactFactory(org.jivesoftware.openfire.spi.EncryptionArtifactFactory)

Aggregations

SslFilter (org.apache.mina.filter.ssl.SslFilter)11 InetSocketAddress (java.net.InetSocketAddress)6 ExecutorFilter (org.apache.mina.filter.executor.ExecutorFilter)6 KeyManagementException (java.security.KeyManagementException)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 SSLContext (javax.net.ssl.SSLContext)3 DefaultIoFilterChainBuilder (org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder)3 IoFilter (org.apache.mina.core.filterchain.IoFilter)3 OrderedThreadPoolExecutor (org.apache.mina.filter.executor.OrderedThreadPoolExecutor)3 UnorderedThreadPoolExecutor (org.apache.mina.filter.executor.UnorderedThreadPoolExecutor)3 LoggingFilter (org.apache.mina.filter.logging.LoggingFilter)3 IOException (java.io.IOException)2 KeyStoreException (java.security.KeyStoreException)2 UnrecoverableKeyException (java.security.UnrecoverableKeyException)2 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)2 LdapException (org.apache.directory.api.ldap.model.exception.LdapException)2 ProtocolCodecFilter (org.apache.mina.filter.codec.ProtocolCodecFilter)2 NioSocketAcceptor (org.apache.mina.transport.socket.nio.NioSocketAcceptor)2 NioSocketConnector (org.apache.mina.transport.socket.nio.NioSocketConnector)2 ConnectException (java.net.ConnectException)1