Package tigase.io
Class SSLContextContainer
java.lang.Object
tigase.io.SSLContextContainerAbstract
tigase.io.SSLContextContainer
- All Implemented Interfaces:
SSLContextContainerIfc
,Initializable
,Lifecycle
- Direct Known Subclasses:
SSLContextContainer.Root
@Bean(name="sslContextContainer",
parent=ConnectionManager.class,
active=true)
public class SSLContextContainer
extends SSLContextContainerAbstract
implements Initializable
Created: Oct 15, 2010 2:40:49 PM
- Author:
- Artur Hefczyc
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static class
static class
static class
Nested classes/interfaces inherited from class tigase.io.SSLContextContainerAbstract
SSLContextContainerAbstract.SSLHolder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EventBus
protected Map<String,
SSLContextContainerAbstract.SSLHolder> protected VHostManagerIfc
Fields inherited from interface tigase.io.SSLContextContainerIfc
ALLOW_INVALID_CERTS_KEY, ALLOW_INVALID_CERTS_VAL, ALLOW_SELF_SIGNED_CERTS_KEY, ALLOW_SELF_SIGNED_CERTS_VAL, CERT_ALIAS_KEY, CERT_SAVE_TO_DISK_KEY, DEFAULT_DOMAIN_CERT_KEY, DEFAULT_DOMAIN_CERT_VAL, JKS_KEYSTORE_FILE_KEY, JKS_KEYSTORE_FILE_VAL, JKS_KEYSTORE_PWD_KEY, JKS_KEYSTORE_PWD_VAL, PEM_CERTIFICATE_KEY, SERVER_CERTS_LOCATION_KEY, SERVER_CERTS_LOCATION_VAL, SSL_CONTAINER_CLASS_KEY, SSL_CONTAINER_CLASS_VAL, TRUSTED_CERTS_DIR_KEY, TRUSTED_CERTS_DIR_VAL, TRUSTSTORE_FILE_KEY, TRUSTSTORE_FILE_VAL, TRUSTSTORE_PWD_KEY, TRUSTSTORE_PWD_VAL
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for bean onlySSLContextContainer
(CertificateContainerIfc certContainer) Constructor used to create root SSLContextContainer instance which should cache only SSLContext instances where array of TrustManagers is not set - common for all ConnectionManagers.SSLContextContainer
(CertificateContainerIfc certContainer, SSLContextContainerIfc parent) Constructor used to create instances for every ConnectionManager so that every connection manager can have different TrustManagers and SSLContext instance will still be cached. -
Method Summary
Modifier and TypeMethodDescriptioncreateIoInterface
(String protocol, String local_hostname, String remote_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface socketIO, CertificateContainerIfc certificateContainer) String[]
getEnabledCiphers
(String domain) String[]
getEnabledProtocols
(String domain, boolean client) getSSLContext
(String protocol, String hostname, boolean clientMode, TrustManager[] tms) MethodgetSSLContext
creates and returns new SSLContext for a given domain (hostname).Returns a trust store with all trusted certificates.void
Method will be called, when bean will be created, configured and ready to use.void
setEnabledCiphers
(String[] enabledCiphers) void
setEnabledProtocols
(String[] enabledProtocols) void
setEphemeralDHKeySize
(int ephemeralDHKeySize) void
setHardenedMode
(SSLContextContainer.HARDENED_MODE hardenedMode) void
setParent
(SSLContextContainerIfc parent) void
setTlsJdkNssBugWorkaround
(boolean value) void
start()
void
stop()
Methods inherited from class tigase.io.SSLContextContainerAbstract
addCertificates, createCertificate, createContextHolder, find, getDefCertAlias, getKeyManagers, getSSLContext, getTrustManagers
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface tigase.io.SSLContextContainerIfc
createIoInterface, getEnabledCiphers, getEnabledProtocols
-
Field Details
-
eventBus
-
sslContexts
-
vHostManager
-
-
Constructor Details
-
SSLContextContainer
public SSLContextContainer()Constructor for bean only -
SSLContextContainer
Constructor used to create root SSLContextContainer instance which should cache only SSLContext instances where array of TrustManagers is not set - common for all ConnectionManagers. This instance is kept by TLSUtil class. -
SSLContextContainer
Constructor used to create instances for every ConnectionManager so that every connection manager can have different TrustManagers and SSLContext instance will still be cached.
-
-
Method Details
-
createIoInterface
public IOInterface createIoInterface(String protocol, String local_hostname, String remote_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface socketIO, CertificateContainerIfc certificateContainer) throws IOException - Specified by:
createIoInterface
in interfaceSSLContextContainerIfc
- Throws:
IOException
-
getEnabledCiphers
- Specified by:
getEnabledCiphers
in interfaceSSLContextContainerIfc
-
setEnabledCiphers
-
getEnabledProtocols
- Specified by:
getEnabledProtocols
in interfaceSSLContextContainerIfc
-
setEnabledProtocols
-
setEphemeralDHKeySize
public void setEphemeralDHKeySize(int ephemeralDHKeySize) -
getSSLContext
public SSLContext getSSLContext(String protocol, String hostname, boolean clientMode, TrustManager[] tms) Description copied from interface:SSLContextContainerIfc
MethodgetSSLContext
creates and returns new SSLContext for a given domain (hostname). For creation of the SSLContext a certificate associated with this domain (hostname) should be used. If there is no specific certificate for a given domain then default certificate should be used.- Specified by:
getSSLContext
in interfaceSSLContextContainerIfc
- Parameters:
protocol
- aString
is either 'SSL' or 'TLS' value.hostname
- aString
value keeps a hostname or domain for SSLContext.clientMode
- if set SSLContext will be created for client mode (ie. creation of server certificate will be skipped if there is no certificate)tms
- array of TrustManagers which should be used to validate remote certificate- Returns:
- a
SSLContext
value
-
getTrustStore
Description copied from interface:SSLContextContainerIfc
Returns a trust store with all trusted certificates.- Specified by:
getTrustStore
in interfaceSSLContextContainerIfc
- Overrides:
getTrustStore
in classSSLContextContainerAbstract
- Returns:
- a KeyStore with all trusted certificates, the KeyStore can be empty but cannot be null.
-
setHardenedMode
-
setParent
-
setTlsJdkNssBugWorkaround
public void setTlsJdkNssBugWorkaround(boolean value) -
initialize
public void initialize()Description copied from interface:Initializable
Method will be called, when bean will be created, configured and ready to use.- Specified by:
initialize
in interfaceInitializable
-
start
public void start() -
stop
public void stop()
-