java.lang.Object
org.glassfish.grizzly.ssl.SSLEngineConfigurator
- All Implemented Interfaces:
SSLEngineFactory
Utility class, which helps to configure
SSLEngine.- Author:
- Alexey Stashok
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanClient mode when handshaking.protected SSLContextprotected SSLContextConfigurator -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSSLEngineConfigurator(SSLContext sslContext) Create SSL Engine configuration basing on passedSSLContext.SSLEngineConfigurator(SSLContext sslContext, boolean clientMode, boolean needClientAuth, boolean wantClientAuth) Create SSL Engine configuration basing on passedSSLContext, using passed client mode, need/want client auth parameters.SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration) Create SSL Engine configuration basing on passedSSLContextConfigurator.SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration, boolean clientMode, boolean needClientAuth, boolean wantClientAuth) Create SSL Engine configuration basing on passedSSLContextConfigurator. -
Method Summary
Modifier and TypeMethodDescriptionConfigure passedSSLEngine, using current configurator settingscopy()Create and configureSSLEngineusing this context configuration.createSSLEngine(String peerHost, int peerPort) Create and configureSSLEngineusing this context configuration using advisory peer information.String[]String[]booleanWillSSLEnginebe configured to work in client mode.booleanbooleansetClientMode(boolean clientMode) SetSSLEngineto be configured to work in client mode.setEnabledCipherSuites(String[] enabledCipherSuites) Sets a list of enabled cipher suites.setEnabledProtocols(String[] enabledProtocols) Sets a list of enabled protocols.setNeedClientAuth(boolean needClientAuth) setSSLParameters(SSLParameters sslParameters) ApplySSLParametersto this SSLEngineConfigurator.setWantClientAuth(boolean wantClientAuth) toString()
-
Field Details
-
sslContextConfiguration
-
sslContext
-
clientMode
protected boolean clientModeClient mode when handshaking.
-
-
Constructor Details
-
SSLEngineConfigurator
Create SSL Engine configuration basing on passedSSLContext.- Parameters:
sslContext-SSLContext.
-
SSLEngineConfigurator
public SSLEngineConfigurator(SSLContext sslContext, boolean clientMode, boolean needClientAuth, boolean wantClientAuth) Create SSL Engine configuration basing on passedSSLContext, using passed client mode, need/want client auth parameters.- Parameters:
sslContext-SSLContext.clientMode-needClientAuth-wantClientAuth-
-
SSLEngineConfigurator
Create SSL Engine configuration basing on passedSSLContextConfigurator. This constructor makes possible to initialize SSLEngine and SSLContext in lazy fashion on firstcreateSSLEngine()call.- Parameters:
sslContextConfiguration-SSLContextConfigurator.
-
SSLEngineConfigurator
public SSLEngineConfigurator(SSLContextConfigurator sslContextConfiguration, boolean clientMode, boolean needClientAuth, boolean wantClientAuth) Create SSL Engine configuration basing on passedSSLContextConfigurator. This constructor makes possible to initialize SSLEngine and SSLContext in lazy fashion on firstcreateSSLEngine()call.- Parameters:
sslContextConfiguration-SSLContextConfigurator.clientMode-needClientAuth-wantClientAuth-
-
SSLEngineConfigurator
-
SSLEngineConfigurator
protected SSLEngineConfigurator()
-
-
Method Details
-
createSSLEngine
Create and configureSSLEngineusing this context configuration.- Returns:
SSLEngine.
-
createSSLEngine
Create and configureSSLEngineusing this context configuration using advisory peer information.Applications using this factory method are providing hints for an internal session reuse strategy.
Some cipher suites (such as Kerberos) require remote hostname information, in which case peerHost needs to be specified.
- Specified by:
createSSLEnginein interfaceSSLEngineFactory- Parameters:
peerHost- the non-authoritative name of the hostpeerPort- the non-authoritative port- Returns:
SSLEngine.
-
configure
Configure passedSSLEngine, using current configurator settings -
isClientMode
public boolean isClientMode()WillSSLEnginebe configured to work in client mode.- Returns:
- true, if
SSLEnginewill be configured to work in client mode, or false for server mode.
-
setClientMode
SetSSLEngineto be configured to work in client mode.- Parameters:
clientMode- true, ifSSLEnginewill be configured to work in client mode, or false for server mode.- Returns:
- this SSLEngineConfigurator
-
isNeedClientAuth
public boolean isNeedClientAuth() -
setNeedClientAuth
-
isWantClientAuth
public boolean isWantClientAuth() -
setWantClientAuth
-
setSSLParameters
ApplySSLParametersto this SSLEngineConfigurator.- Parameters:
sslParameters-- Returns:
- this SSLEngineConfigurator
-
getEnabledCipherSuites
- Returns:
- an array of enabled cipher suites. Modifications made on the array content won't be propagated to SSLEngineConfigurator
-
setEnabledCipherSuites
Sets a list of enabled cipher suites. Note: further modifications made on the passed array won't be propagated to SSLEngineConfigurator.- Parameters:
enabledCipherSuites- list of enabled cipher suites- Returns:
- this SSLEngineConfigurator
-
getEnabledProtocols
- Returns:
- an array of enabled protocols. Modifications made on the array content won't be propagated to SSLEngineConfigurator
-
setEnabledProtocols
Sets a list of enabled protocols. Note: further modifications made on the passed array won't be propagated to SSLEngineConfigurator.- Parameters:
enabledProtocols- list of enabled protocols- Returns:
- this SSLEngineConfigurator
-
getSslContext
-
toString
-
copy
-