SslFilter filter = new SslFilter(sslContext); SSLParameters sslParameters = sslContext.getDefaultSSLParameters(); filter.setEnabledProtocols(getFilteredProtocols(sslParameters)); filter.setEnabledCipherSuites(getFilteredCipherSuites(sslParameters)); acceptor.getFilterChain().addFirst("ssl", filter);
log.debug("Using these protocols: {}", Arrays.toString(protocols)); sslFilter.setEnabledProtocols(protocols);
/** * A utility method that implements the shared functionality of getServerModeSslFilter and getClientModeSslFilter. * * This method is used to initialize and configure an instance of SslFilter for a particular pre-configured * SSLContext and SSLEngine. In most cases, developers will want to use getServerModeSslFilter or * getClientModeSslFilter instead of this method. * * @param sslContext a pre-configured SSL Context instance (cannot be null). * @param sslEngine a pre-configured SSL Engine instance (cannot be null). * @return A SslFilter instance (never null). */ private static SslFilter createSslFilter( SSLContext sslContext, SSLEngine sslEngine ) { final SslFilter filter = new SslFilter( sslContext ); // Copy configuration from the SSL Engine into the filter. filter.setUseClientMode( sslEngine.getUseClientMode() ); filter.setEnabledProtocols( sslEngine.getEnabledProtocols() ); filter.setEnabledCipherSuites( sslEngine.getEnabledCipherSuites() ); // Note that the setters for 'need' and 'want' influence each-other. Invoke only one of them! if ( sslEngine.getNeedClientAuth() ) { filter.setNeedClientAuth( true ); } else if ( sslEngine.getWantClientAuth() ) { filter.setWantClientAuth( true ); } return filter; }
public SslFilter getSslFilter() throws Exception { if (keystoreFile == null || truststoreFile == null) { throw new NotActiveException("Keystore or truststore are null"); } SSLContext context = getSslContext(); if (context == null) { throw new NotActiveException("SSLContext is null"); } // create the ssl filter using server mode SslFilter sslFilter = new SslFilter(context); if (cipherSuites != null) { sslFilter.setEnabledCipherSuites(cipherSuites); } if (protocols != null) { if (log.isDebugEnabled()) { log.debug("Using these protocols: {}", Arrays.toString(protocols)); } sslFilter.setEnabledProtocols(protocols); } return sslFilter; }
sslFilter.setEnabledProtocols( enabledProtocols.toArray( new String[enabledProtocols.size()] ) ); sslFilter.setEnabledProtocols( new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" } );
sslFilter.setEnabledProtocols( enabledProtocols.toArray( new String[enabledProtocols.size()] ) ); sslFilter.setEnabledProtocols( new String[]{ "TLSv1", "TLSv1.1", "TLSv1.2" } ); sslFilter.setEnabledProtocols( new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" } ); sslFilter.startSsl( session.getIoSession() );
SslFilter filter = new SslFilter(sslContext); SSLParameters sslParameters = sslContext.getDefaultSSLParameters(); filter.setEnabledProtocols(getFilteredProtocols(sslParameters)); filter.setEnabledCipherSuites(getFilteredCipherSuites(sslParameters)); acceptor.getFilterChain().addFirst("ssl", filter);
sslFilter.setEnabledProtocols( enabledProtocols ); sslFilter.setEnabledProtocols( new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" } );
sslFilter.setEnabledProtocols( enabledProtocols ); sslFilter.setEnabledProtocols( new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" } );
sslFilter.setEnabledProtocols( enabledProtocols ); sslFilter.setEnabledProtocols( new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" } );
/** * A utility method that implements the shared functionality of getServerModeSslFilter and getClientModeSslFilter. * * This method is used to initialize and configure an instance of SslFilter for a particular pre-configured * SSLContext and SSLEngine. In most cases, developers will want to use getServerModeSslFilter or * getClientModeSslFilter instead of this method. * * @param sslContext a pre-configured SSL Context instance (cannot be null). * @param sslEngine a pre-configured SSL Engine instance (cannot be null). * @return A SslFilter instance (never null). */ private static SslFilter createSslFilter( SSLContext sslContext, SSLEngine sslEngine ) { final SslFilter filter = new SslFilter( sslContext ); // Copy configuration from the SSL Engine into the filter. filter.setUseClientMode( sslEngine.getUseClientMode() ); filter.setEnabledProtocols( sslEngine.getEnabledProtocols() ); filter.setEnabledCipherSuites( sslEngine.getEnabledCipherSuites() ); // Note that the setters for 'need' and 'want' influence each-other. Invoke only one of them! if ( sslEngine.getNeedClientAuth() ) { filter.setNeedClientAuth( true ); } else if ( sslEngine.getWantClientAuth() ) { filter.setWantClientAuth( true ); } return filter; }
String[] protocols = (String[])commons.getObject("enabledProtocols"); if(protocols != null) sslFilter.setEnabledProtocols(protocols); boolean needClientAuth = commons.getBoolean("needClientAuth",false); boolean wantClientAuth = commons.getBoolean("wantClientAuth",false);
String[] protocols = (String[])commons.getObject("enabledProtocols"); if(protocols != null) sslFilter.setEnabledProtocols(protocols);