public final class TCPProxySSLSocketFactoryImplementation extends Object implements TCPProxySSLSocketFactory
TCPProxySocketFactory
for SSL connections.
ARGHH. I hate JSSE.
The JSSE docs rabbit on about being able to create factories with the required parameters, this is a lie. Where is "SSL[Server]SocketFactory.setEnabledCipherSuites()"? Hence the need for our own abstract factories.
We can't install our own TrustManagerFactory without messing with the security properties file. Hence we create our own SSLContext and initialise it.
- PhilAConstructor and Description |
---|
TCPProxySSLSocketFactoryImplementation()
Construct a TCPProxySSLSocketFactoryImplementation that uses the
built-in key store.
|
TCPProxySSLSocketFactoryImplementation(File keyStoreFile,
char[] keyStorePassword,
String keyStoreType)
Construct a TCPProxySSLSocketFactoryImplementation that uses the
specified key store.
|
Modifier and Type | Method and Description |
---|---|
Socket |
createClientSocket(EndPoint remoteEndPoint)
Factory method for client sockets.
|
Socket |
createClientSocket(Socket existingSocket,
EndPoint remoteEndPoint)
Factory method for client sockets that are layered over
existing sockets.
|
ServerSocket |
createServerSocket(EndPoint localEndPoint,
int timeout)
Factory method for server sockets.
|
public TCPProxySSLSocketFactoryImplementation(File keyStoreFile, char[] keyStorePassword, String keyStoreType) throws IOException, GeneralSecurityException, SSLContextFactory.SSLContextFactoryException
keyStoreFile
- Key store file.keyStorePassword
- Key store password, or null
if no password.keyStoreType
- Key store type, or null
if the
default keystore type should be used.IOException
- If an I/O error occurs.GeneralSecurityException
- If a security error occurs.SSLContextFactory.SSLContextFactoryException
- If SSLContext could not be created.public TCPProxySSLSocketFactoryImplementation() throws IOException, GeneralSecurityException, SSLContextFactory.SSLContextFactoryException
IOException
- If an I/O error occurs.GeneralSecurityException
- If a security error occurs.SSLContextFactory.SSLContextFactoryException
- If SSLContext could not be created.public ServerSocket createServerSocket(EndPoint localEndPoint, int timeout) throws IOException
createServerSocket
in interface TCPProxySocketFactory
localEndPoint
- Local host and port.timeout
- Socket timeout.ServerSocket
.IOException
- If an error occurs.public Socket createClientSocket(EndPoint remoteEndPoint) throws IOException
createClientSocket
in interface TCPProxySocketFactory
remoteEndPoint
- Remote host and port.Socket
.IOException
- If an error occurs.public Socket createClientSocket(Socket existingSocket, EndPoint remoteEndPoint) throws IOException
Factory method for client sockets that are layered over existing sockets. Used to establish HTTPS proxy connections.
The SSL socket takes ownership of the existing socket; when the SSL socket is closed, the existing socket will also be closed.
createClientSocket
in interface TCPProxySSLSocketFactory
existingSocket
- The existing socket.remoteEndPoint
- Remote host and port. Not the proxy. As far as I
can gather, the JSSE does not use this information.Socket
.IOException
- If an error occurs.Copyright © 2000-2014. All Rights Reserved.