Class MutualSSLSocketFactory
- java.lang.Object
-
- javax.net.SocketFactory
-
- javax.net.ssl.SSLSocketFactory
-
- africa.absa.inception.core.util.MutualSSLSocketFactory
-
public class MutualSSLSocketFactory extends SSLSocketFactory
The MutualSSLSocketFactory class implements the custom SSL socket factory that supports Mutual SSL authentication.- Author:
- Marcus Portmann
-
-
Constructor Summary
Constructors Constructor Description MutualSSLSocketFactory(KeyStore keyStore, String keyStorePassword, KeyStore trustStore, boolean disableServerTrustChecking)Constructs a new MutualSSLSocketFactory
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketcreateSocket(String host, int port)Creates a socket and connects it to the specified remote host at the specified remote port.SocketcreateSocket(String host, int port, InetAddress localHost, int localPort)Creates a socket and connects it to the specified remote host at the specified remote port.SocketcreateSocket(InetAddress host, int port)Creates a socket and connects it to the specified port number at the specified address.SocketcreateSocket(InetAddress host, int port, InetAddress localHost, int localPort)Creates a socket and connects it to the specified port number at the specified address.SocketcreateSocket(Socket s, String host, int port, boolean autoClose)Returns a socket layered over an existing socket connected to the named host, at the given port.String[]getDefaultCipherSuites()Returns the cipher suites which are enabled by default.String[]getSupportedCipherSuites()Returns the names of the cipher suites which could be enabled for use on an SSL connection.static booleanisIBMJDK()Returns true if we are running under the IBM JDK or false otherwise.-
Methods inherited from class javax.net.ssl.SSLSocketFactory
createSocket, getDefault
-
Methods inherited from class javax.net.SocketFactory
createSocket
-
-
-
-
Constructor Detail
-
MutualSSLSocketFactory
public MutualSSLSocketFactory(KeyStore keyStore, String keyStorePassword, KeyStore trustStore, boolean disableServerTrustChecking)
Constructs a new MutualSSLSocketFactory- Parameters:
keyStore- the key store containing the client certificate and private keykeyStorePassword- the password required to access the key storetrustStore- the trust storedisableServerTrustChecking- disable server trust checking
-
-
Method Detail
-
isIBMJDK
public static boolean isIBMJDK()
Returns true if we are running under the IBM JDK or false otherwise.- Returns:
- true if we are running under the IBM JDK or false otherwise
-
createSocket
public Socket createSocket(InetAddress host, int port) throws IOException
Creates a socket and connects it to the specified port number at the specified address.This socket is configured using the socket options established for this factory. If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException.
- Specified by:
createSocketin classSocketFactory- Parameters:
host- the address of the server hostport- the server port- Returns:
- a socket connected to the specified host and port
- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port) throws IOException
Creates a socket and connects it to the specified remote host at the specified remote port.This socket is configured using the socket options established for this factory. If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException.
- Specified by:
createSocketin classSocketFactory- Parameters:
host- the server hostport- the server port- Returns:
- a socket connected to the specified host and port
- Throws:
IOException
-
createSocket
public Socket createSocket(InetAddress host, int port, InetAddress localHost, int localPort) throws IOException
Creates a socket and connects it to the specified port number at the specified address. The socket will also be bound to the local address and port supplied.This socket is configured using the socket options established for this factory. If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException.
- Specified by:
createSocketin classSocketFactory- Parameters:
host- the address of the server hostport- the server portlocalHost- the local addresslocalPort- the local port- Returns:
- a socket connected to the specified host and port
- Throws:
IOException
-
createSocket
public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException
Returns a socket layered over an existing socket connected to the named host, at the given port.This constructor can be used when tunneling SSL through a proxy or when negotiating the use of SSL over an existing socket. The host and port refer to the logical peer destination. This socket is configured using the socket options established for this factory.
- Specified by:
createSocketin classSSLSocketFactory- Parameters:
s- the existing sockethost- the server hostport- the server portautoClose- close the underlying socket when this socket is closed- Returns:
- a socket connected to the specified host and port
- Throws:
IOException
-
createSocket
public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException
Creates a socket and connects it to the specified remote host at the specified remote port. The socket will also be bound to the local address and port supplied.This socket is configured using the socket options established for this factory. If there is a security manager, its checkConnect method is called with the host address and port as its arguments. This could result in a SecurityException.
- Specified by:
createSocketin classSocketFactory- Parameters:
host- the server hostport- the server portlocalHost- the local addresslocalPort- the local port- Returns:
- a socket connected to the specified host and port
- Throws:
IOException
-
getDefaultCipherSuites
public String[] getDefaultCipherSuites()
Returns the cipher suites which are enabled by default.Unless a different list is enabled, handshaking on an SSL connection will use one of these cipher suites. The minimum quality of service for these defaults requires confidentiality protection and server authentication (that is, no anonymous cipher suites).
- Specified by:
getDefaultCipherSuitesin classSSLSocketFactory- Returns:
- the cipher suites which are enabled by default
-
getSupportedCipherSuites
public String[] getSupportedCipherSuites()
Returns the names of the cipher suites which could be enabled for use on an SSL connection.Normally, only a subset of these will actually be enabled by default, since this list may include cipher suites which do not meet quality of service requirements for those defaults. Such cipher suites are useful in specialized applications.
- Specified by:
getSupportedCipherSuitesin classSSLSocketFactory- Returns:
- the names of the cipher suites which could be enabled for use on an SSL connection
-
-