org.glassfish.grizzly.ssl
Class SSLEngineConfigurator

java.lang.Object
  extended by org.glassfish.grizzly.ssl.SSLEngineConfigurator

public class SSLEngineConfigurator
extends Object

Utility class, which helps to configure SSLEngine.

Author:
Alexey Stashok

Field Summary
protected  boolean clientMode
          Client mode when handshaking.
protected  String[] enabledCipherSuites
          The list of cipher suite
protected  String[] enabledProtocols
          the list of protocols
protected  boolean needClientAuth
          Require client Authentication.
protected  SSLContext sslContext
           
protected  SSLContextConfigurator sslContextConfiguration
           
protected  boolean wantClientAuth
          True when requesting authentication.
 
Constructor Summary
protected SSLEngineConfigurator()
           
  SSLEngineConfigurator(SSLContext sslContext)
          Create SSL Engine configuration basing on passed SSLContext.
  SSLEngineConfigurator(SSLContext sslContext, boolean clientMode, boolean needClientAuth, boolean wantClientAuth)
          Create SSL Engine configuration basing on passed SSLContext, using passed client mode, need/want client auth parameters.
  SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration)
          Create SSL Engine configuration basing on passed SSLContextConfigurator.
  SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration, boolean clientMode, boolean needClientAuth, boolean wantClientAuth)
          Create SSL Engine configuration basing on passed SSLContextConfigurator.
  SSLEngineConfigurator(SSLEngineConfigurator pattern)
           
 
Method Summary
 SSLEngine configure(SSLEngine sslEngine)
          Configure passed SSLEngine, using current configurator settings
 SSLEngineConfigurator copy()
           
 SSLEngine createSSLEngine()
          Create and configure SSLEngine, basing on current settings.
 String[] getEnabledCipherSuites()
           
 String[] getEnabledProtocols()
           
 SSLContext getSslContext()
           
 boolean isCipherConfigured()
           
 boolean isClientMode()
          Will SSLEngine be configured to work in client mode.
 boolean isNeedClientAuth()
           
 boolean isProtocolConfigured()
           
 boolean isWantClientAuth()
           
 SSLEngineConfigurator setCipherConfigured(boolean isCipherConfigured)
           
 SSLEngineConfigurator setClientMode(boolean clientMode)
          Set SSLEngine to be configured to work in client mode.
 SSLEngineConfigurator setEnabledCipherSuites(String[] enabledCipherSuites)
           
 SSLEngineConfigurator setEnabledProtocols(String[] enabledProtocols)
           
 SSLEngineConfigurator setNeedClientAuth(boolean needClientAuth)
           
 SSLEngineConfigurator setProtocolConfigured(boolean isProtocolConfigured)
           
 SSLEngineConfigurator setWantClientAuth(boolean wantClientAuth)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sslContextConfiguration

protected volatile SSLContextConfigurator sslContextConfiguration

sslContext

protected volatile SSLContext sslContext

enabledCipherSuites

protected String[] enabledCipherSuites
The list of cipher suite


enabledProtocols

protected String[] enabledProtocols
the list of protocols


clientMode

protected boolean clientMode
Client mode when handshaking.


needClientAuth

protected boolean needClientAuth
Require client Authentication.


wantClientAuth

protected boolean wantClientAuth
True when requesting authentication.

Constructor Detail

SSLEngineConfigurator

public SSLEngineConfigurator(SSLContext sslContext)
Create SSL Engine configuration basing on passed SSLContext.

Parameters:
sslContext - SSLContext.

SSLEngineConfigurator

public SSLEngineConfigurator(SSLContext sslContext,
                             boolean clientMode,
                             boolean needClientAuth,
                             boolean wantClientAuth)
Create SSL Engine configuration basing on passed SSLContext, using passed client mode, need/want client auth parameters.

Parameters:
sslContext - SSLContext.
clientMode -
needClientAuth -
wantClientAuth -

SSLEngineConfigurator

public SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration)
Create SSL Engine configuration basing on passed SSLContextConfigurator. This constructor makes possible to initialize SSLEngine and SSLContext in lazy fashion on first createSSLEngine() call.

Parameters:
sslContextConfiguration - SSLContextConfigurator.

SSLEngineConfigurator

public SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration,
                             boolean clientMode,
                             boolean needClientAuth,
                             boolean wantClientAuth)
Create SSL Engine configuration basing on passed SSLContextConfigurator. This constructor makes possible to initialize SSLEngine and SSLContext in lazy fashion on first createSSLEngine() call.

Parameters:
sslContextConfiguration - SSLContextConfigurator.
clientMode -
needClientAuth -
wantClientAuth -

SSLEngineConfigurator

public SSLEngineConfigurator(SSLEngineConfigurator pattern)

SSLEngineConfigurator

protected SSLEngineConfigurator()
Method Detail

createSSLEngine

public SSLEngine createSSLEngine()
Create and configure SSLEngine, basing on current settings.

Returns:
SSLEngine.

configure

public SSLEngine configure(SSLEngine sslEngine)
Configure passed SSLEngine, using current configurator settings

Parameters:
sslEngine - SSLEngine to configure.
Returns:
configured SSLEngine.

isClientMode

public boolean isClientMode()
Will SSLEngine be configured to work in client mode.

Returns:
true, if SSLEngine will be configured to work in client mode, or false for server mode.

setClientMode

public SSLEngineConfigurator setClientMode(boolean clientMode)
Set SSLEngine to be configured to work in client mode.

Parameters:
clientMode - true, if SSLEngine will be configured to work in client mode, or false for server mode.

isNeedClientAuth

public boolean isNeedClientAuth()

setNeedClientAuth

public SSLEngineConfigurator setNeedClientAuth(boolean needClientAuth)

isWantClientAuth

public boolean isWantClientAuth()

setWantClientAuth

public SSLEngineConfigurator setWantClientAuth(boolean wantClientAuth)

getEnabledCipherSuites

public String[] getEnabledCipherSuites()

setEnabledCipherSuites

public SSLEngineConfigurator setEnabledCipherSuites(String[] enabledCipherSuites)

getEnabledProtocols

public String[] getEnabledProtocols()

setEnabledProtocols

public SSLEngineConfigurator setEnabledProtocols(String[] enabledProtocols)

isCipherConfigured

public boolean isCipherConfigured()

setCipherConfigured

public SSLEngineConfigurator setCipherConfigured(boolean isCipherConfigured)

isProtocolConfigured

public boolean isProtocolConfigured()

setProtocolConfigured

public SSLEngineConfigurator setProtocolConfigured(boolean isProtocolConfigured)

getSslContext

public SSLContext getSslContext()

toString

public String toString()
Overrides:
toString in class Object

copy

public SSLEngineConfigurator copy()


Copyright © 2012 Oracle Corporation. All Rights Reserved.