Package net.dona.doip.util.tls
Class TlsProtocolAndCipherSuiteConfigurationUtil
- java.lang.Object
-
- net.dona.doip.util.tls.TlsProtocolAndCipherSuiteConfigurationUtil
-
public class TlsProtocolAndCipherSuiteConfigurationUtil extends java.lang.Object
Utilities for restricting TLS connections to use appropriate protocol versions and cipher suites.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TlsProtocolAndCipherSuiteConfigurationUtil.ServerSocketFactoryWrapper
A wrapper for anSSLServerSocketFactory
which ensures that all created server sockets will use appropriate protocols and cipher suites.static class
TlsProtocolAndCipherSuiteConfigurationUtil.SocketFactoryWrapper
A wrapper for anSSLSocketFactory
which ensures that all created sockets will use appropriate protocols and cipher suites.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String[]
ENABLED_CIPHER_SUITES
A list of TLS cipher suites both provided by the JVM and considered sufficiently strong.static java.lang.String[]
ENABLED_PROTOCOLS
A list of TLS protocols both provided by the JVM and considered sufficiently strong.
-
Constructor Summary
Constructors Constructor Description TlsProtocolAndCipherSuiteConfigurationUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.net.ServerSocket
configureEnabledProtocolsAndCipherSuites(java.net.ServerSocket s)
Configures anSSLServerSocket
to use the appropriate protocols and cipher suites.static java.net.Socket
configureEnabledProtocolsAndCipherSuites(java.net.Socket s)
Configures anSSLSocket
to use the appropriate protocols and cipher suites.static javax.net.ssl.SSLContext
getAllTrustingClientSSLContext()
Returns anSSLContext
which trusts all server certificates.
-
-
-
Field Detail
-
ENABLED_PROTOCOLS
public static final java.lang.String[] ENABLED_PROTOCOLS
A list of TLS protocols both provided by the JVM and considered sufficiently strong.
-
ENABLED_CIPHER_SUITES
public static final java.lang.String[] ENABLED_CIPHER_SUITES
A list of TLS cipher suites both provided by the JVM and considered sufficiently strong.
-
-
Method Detail
-
configureEnabledProtocolsAndCipherSuites
public static java.net.Socket configureEnabledProtocolsAndCipherSuites(java.net.Socket s)
Configures anSSLSocket
to use the appropriate protocols and cipher suites. If the input is not anSSLSocket
no action is taken.- Parameters:
s
- aSocket
- Returns:
- the input
Socket
-
configureEnabledProtocolsAndCipherSuites
public static java.net.ServerSocket configureEnabledProtocolsAndCipherSuites(java.net.ServerSocket s)
Configures anSSLServerSocket
to use the appropriate protocols and cipher suites. If the input is not anSSLServerSocket
no action is taken.- Parameters:
s
- aServerSocket
- Returns:
- the input
ServerSocket
-
getAllTrustingClientSSLContext
public static javax.net.ssl.SSLContext getAllTrustingClientSSLContext()
Returns anSSLContext
which trusts all server certificates.- Returns:
- an
SSLContext
which trusts all server certificates
-
-