Package tigase.io
Class SSLContextContainer
- java.lang.Object
-
- tigase.io.SSLContextContainerAbstract
-
- tigase.io.SSLContextContainer
-
- All Implemented Interfaces:
SSLContextContainerIfc,Lifecycle
- Direct Known Subclasses:
SSLContextContainer.Root
@Bean(name="sslContextContainer", parent=ConnectionManager.class, active=true) public class SSLContextContainer extends SSLContextContainerAbstract
Created: Oct 15, 2010 2:40:49 PM- Version:
- $Rev$
- Author:
- Artur Hefczyc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSSLContextContainer.Root-
Nested classes/interfaces inherited from class tigase.io.SSLContextContainerAbstract
SSLContextContainerAbstract.SSLHolder
-
-
Field Summary
Fields Modifier and Type Field Description protected EventBuseventBusprotected Map<String,SSLContextContainerAbstract.SSLHolder>sslContexts-
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
Constructors Constructor Description SSLContextContainer()Constructor 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IOInterfacecreateIoInterface(String protocol, String tls_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface socketIO, CertificateContainerIfc certificateContainer)String[]getEnabledCiphers()String[]getEnabledProtocols()SSLContextgetSSLContext(String protocol, String hostname, boolean clientMode, TrustManager[] tms)MethodgetSSLContextcreates and returns new SSLContext for a given domain (hostname).KeyStoregetTrustStore()Returns a trust store with all trusted certificates.voidsetEnabledCiphers(String[] enabledCiphers)voidsetEnabledProtocols(String[] enabledProtocols)voidsetHardenedMode(boolean hardenedMode)voidsetParent(SSLContextContainerIfc parent)voidsetTlsJdkNssBugWorkaround(boolean value)voidstart()voidstop()-
Methods inherited from class tigase.io.SSLContextContainerAbstract
addCertificates, createCertificate, createContextHolder, find, getDefCertAlias, getKeyManagers, getSSLContext, getTrustManagers
-
-
-
-
Field Detail
-
sslContexts
protected Map<String,SSLContextContainerAbstract.SSLHolder> sslContexts
-
-
Constructor Detail
-
SSLContextContainer
public SSLContextContainer()
Constructor for bean only
-
SSLContextContainer
public SSLContextContainer(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. This instance is kept by TLSUtil class.- Parameters:
certContainer-
-
SSLContextContainer
public 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.- Parameters:
certContainer-parent-
-
-
Method Detail
-
createIoInterface
public IOInterface createIoInterface(String protocol, String tls_hostname, int port, boolean clientMode, boolean wantClientAuth, boolean needClientAuth, ByteOrder byteOrder, TrustManager[] x509TrustManagers, TLSEventHandler eventHandler, IOInterface socketIO, CertificateContainerIfc certificateContainer) throws IOException
- Throws:
IOException
-
getEnabledCiphers
public String[] getEnabledCiphers()
-
setEnabledCiphers
public void setEnabledCiphers(String[] enabledCiphers)
-
getEnabledProtocols
public String[] getEnabledProtocols()
-
setEnabledProtocols
public void setEnabledProtocols(String[] enabledProtocols)
-
getSSLContext
public SSLContext getSSLContext(String protocol, String hostname, boolean clientMode, TrustManager[] tms)
Description copied from interface:SSLContextContainerIfcMethodgetSSLContextcreates 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.- Parameters:
protocol- aStringis either 'SSL' or 'TLS' value.hostname- aStringvalue 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
SSLContextvalue
-
getTrustStore
public KeyStore getTrustStore()
Description copied from interface:SSLContextContainerIfcReturns a trust store with all trusted certificates.- Specified by:
getTrustStorein interfaceSSLContextContainerIfc- Overrides:
getTrustStorein classSSLContextContainerAbstract- Returns:
- a KeyStore with all trusted certificates, the KeyStore can be empty but cannot be null.
-
setHardenedMode
public void setHardenedMode(boolean hardenedMode)
-
setParent
public void setParent(SSLContextContainerIfc parent)
-
setTlsJdkNssBugWorkaround
public void setTlsJdkNssBugWorkaround(boolean value)
-
start
public void start()
-
stop
public void stop()
-
-